PageRenderTime 61ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/DICK.B1/IronPython/Lib/iptest/cominterop_util.py

https://bitbucket.org/williamybs/uidipythontool
Python | 700 lines | 532 code | 83 blank | 85 comment | 60 complexity | 59dde52f7aae7adc36f7700c1c3b1168 MD5 | raw file
  1. #####################################################################################
  2. #
  3. # Copyright (c) Microsoft Corporation. All rights reserved.
  4. #
  5. # This source code is subject to terms and conditions of the Microsoft Public License. A
  6. # copy of the license can be found in the License.html file at the root of this distribution. If
  7. # you cannot locate the Microsoft Public License, please send an email to
  8. # ironpy@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
  9. # by the terms of the Microsoft Public License.
  10. #
  11. # You must not remove this notice, or any other, from this software.
  12. #
  13. #
  14. #####################################################################################
  15. # COM interop utility module
  16. import sys
  17. import nt
  18. from iptest.assert_util import *
  19. from iptest.file_util import *
  20. from iptest.process_util import *
  21. if is_cli:
  22. import clr
  23. from System import Type
  24. from System import Activator
  25. from System import Exception as System_dot_Exception
  26. remove_ironpython_dlls(testpath.public_testdir)
  27. load_iron_python_dll()
  28. import IronPython
  29. load_iron_python_test()
  30. import IronPythonTest
  31. #--For asserts in IP/DLR assemblies----------------------------------------
  32. from System.Diagnostics import Debug, DefaultTraceListener
  33. class MyTraceListener(DefaultTraceListener):
  34. def Fail(self, msg, detailMsg=''):
  35. print "ASSERT FAILED:", msg
  36. if detailMsg!='':
  37. print " ", detailMsg
  38. sys.exit(1)
  39. if is_snap:
  40. Debug.Listeners.Clear()
  41. Debug.Listeners.Add(MyTraceListener())
  42. is_pywin32 = False
  43. if sys.platform=="win32":
  44. try:
  45. import win32com.client
  46. is_pywin32 = True
  47. if sys.prefix not in nt.environ["Path"]:
  48. nt.environ["Path"] += ";" + sys.prefix
  49. except:
  50. pass
  51. #------------------------------------------------------------------------------
  52. #--GLOBALS
  53. windir = get_environ_variable("windir")
  54. agentsvr_path = path_combine(windir, r"msagent\agentsvr.exe")
  55. scriptpw_path = path_combine(windir, r"system32\scriptpw.dll")
  56. STRING_VALUES = [ "", "a", "ab", "abc", "aa",
  57. "a" * 100000,
  58. "1", "1.0", "1L", "object", "str", "object()",
  59. " ", "_", "abc ", " abc", " abc ", "ab c", "ab c",
  60. "\ta", "a\t", "\n", "\t", "\na", "a\n"]
  61. STRING_VALUES = [unicode(x) for x in STRING_VALUES] + STRING_VALUES
  62. def aFunc(): pass
  63. class KNew(object): pass
  64. class KOld: pass
  65. NON_NUMBER_VALUES = [ object,
  66. KNew, KOld,
  67. Exception,
  68. object(), KNew(), KOld(),
  69. aFunc, str, eval, type,
  70. [], [3.14], ["abc"],
  71. (), (3,), (u"xyz",),
  72. xrange(5),
  73. {}, {'a':1},
  74. __builtins__,
  75. ]
  76. FPN_VALUES = [ -1.23, -1.0, -0.123, -0.0, 0.123, 1.0, 1.23,
  77. 0.0000001, 3.14159265, 1E10, 1.0E10 ]
  78. UINT_VALUES = [ 0, 1, 2, 7, 10, 32]
  79. INT_VALUES = [ -x for x in UINT_VALUES ] + UINT_VALUES
  80. LONG_VALUES = [long(x) for x in INT_VALUES]
  81. COMPLEX_VALUES = [ 3j]
  82. #--Subclasses of Python/.NET types
  83. class Py_Str(str): pass
  84. if is_cli:
  85. class Py_System_String(System.String): pass
  86. class Py_Float(float): pass
  87. class Py_Double(float): pass
  88. if is_cli:
  89. class Py_System_Double(System.Double): pass
  90. class Py_UShort(int): pass
  91. class Py_ULong(long): pass
  92. class Py_ULongLong(long): pass
  93. class Py_Short(int): pass
  94. class Py_Long(int): pass
  95. if is_cli:
  96. class Py_System_Int32(System.Int32): pass
  97. class Py_LongLong(long): pass
  98. #-------Helpers----------------
  99. def shallow_copy(in_list):
  100. '''
  101. We do not necessarily have access to the copy module.
  102. '''
  103. return [x for x in in_list]
  104. def pos_num_helper(clr_type):
  105. return [
  106. clr_type.MinValue,
  107. clr_type.MinValue + 1,
  108. clr_type.MinValue + 2,
  109. clr_type.MinValue + 10,
  110. clr_type.MaxValue/2,
  111. clr_type.MaxValue - 10,
  112. clr_type.MaxValue - 2,
  113. clr_type.MaxValue - 1,
  114. clr_type.MaxValue,
  115. ]
  116. def overflow_num_helper(clr_type):
  117. return [
  118. clr_type.MinValue - 1,
  119. clr_type.MinValue - 2,
  120. clr_type.MinValue - 3,
  121. clr_type.MinValue - 10,
  122. clr_type.MaxValue + 10,
  123. clr_type.MaxValue + 3,
  124. clr_type.MaxValue + 2,
  125. clr_type.MaxValue + 1,
  126. ]
  127. def valueErrorTrigger(in_type):
  128. ret_val = {}
  129. ############################################################
  130. #Is there anything in Python not being able to evaluate to a bool?
  131. ret_val["VARIANT_BOOL"] = [ ]
  132. ############################################################
  133. ret_val["BYTE"] = shallow_copy(NON_NUMBER_VALUES)
  134. ret_val["BYTE"] += COMPLEX_VALUES
  135. if sys.platform=="win32":
  136. ret_val["BYTE"] += FPN_VALUES #Merlin 323751
  137. ret_val["BYTE"] = [x for x in ret_val["BYTE"] if type(x) not in [unicode, str]] #INCOMPAT BUG - should be ValueError
  138. ret_val["BYTE"] = [x for x in ret_val["BYTE"] if not isinstance(x, KOld)] #INCOMPAT BUG - should be AttributeError
  139. ############################################################
  140. ret_val["BSTR"] = shallow_copy(NON_NUMBER_VALUES)
  141. ret_val["BSTR"] += COMPLEX_VALUES
  142. if sys.platform=="win32":
  143. ret_val["BSTR"] = [] #INCOMPAT BUG
  144. #strip out string values
  145. ret_val["BSTR"] = [x for x in ret_val["BSTR"] if type(x) is not str and type(x) is not KNew and type(x) is not KOld and type(x) is not object]
  146. ############################################################
  147. ret_val["CHAR"] = shallow_copy(NON_NUMBER_VALUES)
  148. ret_val["CHAR"] += COMPLEX_VALUES
  149. if sys.platform=="win32":
  150. ret_val["CHAR"] += FPN_VALUES #Merlin 323751
  151. ############################################################
  152. ret_val["FLOAT"] = shallow_copy(NON_NUMBER_VALUES)
  153. ret_val["FLOAT"] += COMPLEX_VALUES
  154. if sys.platform=="win32":
  155. ret_val["FLOAT"] += UINT_VALUES + INT_VALUES #COMPAT BUG
  156. ############################################################
  157. ret_val["DOUBLE"] = shallow_copy(ret_val["FLOAT"])
  158. ############################################################
  159. ret_val["USHORT"] = shallow_copy(NON_NUMBER_VALUES)
  160. ret_val["USHORT"] += COMPLEX_VALUES
  161. if sys.platform=="win32":
  162. ret_val["USHORT"] += FPN_VALUES #Merlin 323751
  163. ############################################################
  164. ret_val["ULONG"] = shallow_copy(ret_val["USHORT"])
  165. ############################################################
  166. ret_val["ULONGLONG"] = shallow_copy(ret_val["ULONG"])
  167. ############################################################
  168. ret_val["SHORT"] = shallow_copy(NON_NUMBER_VALUES)
  169. ret_val["SHORT"] += COMPLEX_VALUES
  170. if sys.platform=="win32":
  171. ret_val["SHORT"] += FPN_VALUES #Merlin 323751
  172. ############################################################
  173. ret_val["LONG"] = shallow_copy(ret_val["SHORT"])
  174. ############################################################
  175. ret_val["LONGLONG"] = shallow_copy(ret_val["LONG"])
  176. ############################################################
  177. return ret_val[in_type]
  178. def typeErrorTrigger(in_type):
  179. ret_val = {}
  180. ############################################################
  181. #Is there anything in Python not being able to evaluate to a bool?
  182. ret_val["VARIANT_BOOL"] = [ ]
  183. ############################################################
  184. ret_val["BYTE"] = []
  185. ############################################################
  186. ret_val["BSTR"] = []
  187. #strip out string values
  188. ret_val["BSTR"] = [x for x in ret_val["BSTR"] if type(x) is not str]
  189. ############################################################
  190. ret_val["CHAR"] = []
  191. ############################################################
  192. ret_val["FLOAT"] = []
  193. ############################################################
  194. ret_val["DOUBLE"] = []
  195. ############################################################
  196. ret_val["USHORT"] = []
  197. ############################################################
  198. ret_val["ULONG"] = []
  199. ############################################################
  200. ret_val["ULONGLONG"] = []
  201. ############################################################
  202. ret_val["SHORT"] = []
  203. ############################################################
  204. ret_val["LONG"] = []
  205. ############################################################
  206. ret_val["LONGLONG"] = []
  207. ############################################################
  208. return ret_val[in_type]
  209. def overflowErrorTrigger(in_type):
  210. ret_val = {}
  211. ############################################################
  212. ret_val["VARIANT_BOOL"] = []
  213. ############################################################
  214. ret_val["BYTE"] = []
  215. ret_val["BYTE"] += overflow_num_helper(System.Byte)
  216. ############################################################
  217. #Doesn't seem possible to create a value (w/o 1st overflowing
  218. #in Python) to pass to the COM method which will overflow.
  219. ret_val["BSTR"] = [] #["0123456789" * 1234567890]
  220. ############################################################
  221. ret_val["CHAR"] = []
  222. ret_val["CHAR"] += overflow_num_helper(System.SByte)
  223. ############################################################
  224. ret_val["FLOAT"] = []
  225. ret_val["FLOAT"] += overflow_num_helper(System.Double)
  226. #Shouldn't be possible to overflow a double.
  227. ret_val["DOUBLE"] = []
  228. ############################################################
  229. ret_val["USHORT"] = []
  230. ret_val["USHORT"] += overflow_num_helper(System.UInt16)
  231. ret_val["ULONG"] = []
  232. ret_val["ULONG"] += overflow_num_helper(System.UInt32)
  233. ret_val["ULONGLONG"] = []
  234. # Dev10 475426
  235. #ret_val["ULONGLONG"] += overflow_num_helper(System.UInt64)
  236. ret_val["SHORT"] = []
  237. ret_val["SHORT"] += overflow_num_helper(System.Int16)
  238. ret_val["LONG"] = []
  239. # Dev10 475426
  240. #ret_val["LONG"] += overflow_num_helper(System.Int32)
  241. ret_val["LONGLONG"] = []
  242. # Dev10 475426
  243. #ret_val["LONGLONG"] += overflow_num_helper(System.Int64)
  244. ############################################################
  245. return ret_val[in_type]
  246. def pythonToCOM(in_type):
  247. '''
  248. Given a COM type (in string format), this helper function returns a list of
  249. lists where each sublists contains 1-N elements. Each of these elements in
  250. turn are of different types (compatible with in_type), but equivalent to
  251. one another.
  252. '''
  253. ret_val = {}
  254. ############################################################
  255. temp_funcs = [int, bool, System.Boolean] # long, Dev10 475426
  256. temp_values = [ 0, 1, True, False]
  257. ret_val["VARIANT_BOOL"] = [ [y(x) for y in temp_funcs] for x in temp_values]
  258. ############################################################
  259. temp_funcs = [System.Byte]
  260. temp_values = pos_num_helper(System.Byte)
  261. ret_val["BYTE"] = [ [y(x) for y in temp_funcs] for x in temp_values]
  262. ############################################################
  263. temp_funcs = [ str, unicode, # Py_Str, Py_System_String,
  264. System.String ]
  265. temp_values = shallow_copy(STRING_VALUES)
  266. ret_val["BSTR"] = [ [y(x) for y in temp_funcs] for x in temp_values]
  267. ############################################################
  268. temp_funcs = [System.SByte]
  269. temp_values = pos_num_helper(System.SByte)
  270. ret_val["CHAR"] = [ [y(x) for y in temp_funcs] for x in temp_values]
  271. ############################################################
  272. temp_funcs = [ float, # Py_Float,
  273. System.Single]
  274. ret_val["FLOAT"] = [ [y(x) for y in temp_funcs] for x in FPN_VALUES]
  275. ############################################################
  276. temp_funcs = [ float, System.Double] # Py_Double, Py_System_Double,
  277. temp_values = [-1.0e+308, 1.0e308] + FPN_VALUES
  278. ret_val["DOUBLE"] = [ [y(x) for y in temp_funcs] for x in temp_values]
  279. ret_val["DOUBLE"] += ret_val["FLOAT"]
  280. ############################################################
  281. temp_funcs = [int, System.UInt16] # Py_UShort,
  282. temp_values = pos_num_helper(System.UInt16)
  283. ret_val["USHORT"] = [ [y(x) for y in temp_funcs] for x in temp_values]
  284. ############################################################
  285. temp_funcs = [int, System.UInt32] # Py_ULong,
  286. temp_values = pos_num_helper(System.UInt32) + pos_num_helper(System.UInt16)
  287. ret_val["ULONG"] = [ [y(x) for y in temp_funcs] for x in temp_values]
  288. ret_val["ULONG"] += ret_val["USHORT"]
  289. ############################################################
  290. temp_funcs = [int, long, System.UInt64] # Py_ULongLong,
  291. temp_values = pos_num_helper(System.UInt64) + pos_num_helper(System.UInt32) + pos_num_helper(System.UInt16)
  292. ret_val["ULONGLONG"] = [ [y(x) for y in temp_funcs] for x in temp_values]
  293. ret_val["ULONGLONG"] += ret_val["ULONG"]
  294. ############################################################
  295. temp_funcs = [int, System.Int16] # Py_Short,
  296. temp_values = pos_num_helper(System.Int16)
  297. ret_val["SHORT"] = [ [y(x) for y in temp_funcs] for x in temp_values]
  298. ############################################################
  299. temp_funcs = [int, System.Int32] # Py_Long, Dev10 475426
  300. temp_values = pos_num_helper(System.Int32) + pos_num_helper(System.Int16)
  301. ret_val["LONG"] = [ [y(x) for y in temp_funcs] for x in temp_values]
  302. ret_val["LONG"] += ret_val["SHORT"]
  303. ############################################################
  304. temp_funcs = [int, long, System.Int64] # Py_LongLong, Dev10 475426
  305. temp_values = pos_num_helper(System.Int64) + pos_num_helper(System.Int32) + pos_num_helper(System.Int16)
  306. ret_val["LONGLONG"] = [ [y(x) for y in temp_funcs] for x in temp_values]
  307. ret_val["LONGLONG"] += ret_val["LONG"]
  308. ############################################################
  309. return ret_val[in_type]
  310. #------------------------------------------------------------------------------
  311. #--Override a couple of definitions from assert_util
  312. from iptest import assert_util
  313. DEBUG = 1
  314. def assert_helper(in_dict):
  315. #add the keys if they're not there
  316. if not in_dict.has_key("runonly"): in_dict["runonly"] = True
  317. if not in_dict.has_key("skip"): in_dict["skip"] = False
  318. #determine whether this test will be run or not
  319. run = in_dict["runonly"] and not in_dict["skip"]
  320. #strip out the keys
  321. for x in ["runonly", "skip"]: in_dict.pop(x)
  322. if not run:
  323. if in_dict.has_key("bugid"):
  324. print "...skipped an assert due to bug", str(in_dict["bugid"])
  325. elif DEBUG:
  326. print "...skipped an assert on", sys.platform
  327. if in_dict.has_key("bugid"): in_dict.pop("bugid")
  328. return run
  329. def Assert(*args, **kwargs):
  330. if assert_helper(kwargs): assert_util.Assert(*args, **kwargs)
  331. def AreEqual(*args, **kwargs):
  332. if assert_helper(kwargs): assert_util.AreEqual(*args, **kwargs)
  333. def AssertError(*args, **kwargs):
  334. try:
  335. if assert_helper(kwargs): assert_util.AssertError(*args, **kwargs)
  336. except Exception, e:
  337. print "AssertError(" + str(args) + ", " + str(kwargs) + ") failed!"
  338. raise e
  339. def AssertErrorWithMessage(*args, **kwargs):
  340. try:
  341. if assert_helper(kwargs): assert_util.AssertErrorWithMessage(*args, **kwargs)
  342. except Exception, e:
  343. print "AssertErrorWithMessage(" + str(args) + ", " + str(kwargs) + ") failed!"
  344. raise e
  345. def AssertErrorWithPartialMessage(*args, **kwargs):
  346. try:
  347. if assert_helper(kwargs): assert_util.AssertErrorWithPartialMessage(*args, **kwargs)
  348. except Exception, e:
  349. print "AssertErrorWithPartialMessage(" + str(args) + ", " + str(kwargs) + ") failed!"
  350. raise e
  351. def AlmostEqual(*args, **kwargs):
  352. if assert_helper(kwargs): assert_util.AlmostEqual(*args, **kwargs)
  353. #------------------------------------------------------------------------------
  354. #--HELPERS
  355. def TryLoadExcelInteropAssembly():
  356. try:
  357. clr.AddReferenceByName('Microsoft.Office.Interop.Excel, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c')
  358. except:
  359. try:
  360. clr.AddReferenceByName('Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c')
  361. except:
  362. pass
  363. #------------------------------------------------------------------------------
  364. def TryLoadWordInteropAssembly():
  365. try:
  366. clr.AddReferenceByName('Microsoft.Office.Interop.Word, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c')
  367. except:
  368. try:
  369. clr.AddReferenceByName('Microsoft.Office.Interop.Word, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c')
  370. except:
  371. pass
  372. #------------------------------------------------------------------------------
  373. def IsExcelInstalled():
  374. from Microsoft.Win32 import Registry
  375. from System.IO import File
  376. excel = None
  377. #Office 11 or 12 are both OK for this test. Office 12 is preferred.
  378. excel = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Office\\12.0\\Excel\\InstallRoot")
  379. if excel==None:
  380. excel = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Office\\11.0\\Excel\\InstallRoot")
  381. #sanity check
  382. if excel==None:
  383. return False
  384. #make sure it's really installed on disk
  385. excel_path = excel.GetValue("Path") + "excel.exe"
  386. return File.Exists(excel_path)
  387. #------------------------------------------------------------------------------
  388. def IsWordInstalled():
  389. from Microsoft.Win32 import Registry
  390. from System.IO import File
  391. word = None
  392. #Office 11 or 12 are both OK for this test. Office 12 is preferred.
  393. word = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Office\\12.0\\Word\\InstallRoot")
  394. if word==None:
  395. word= Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Office\\11.0\\Word\\InstallRoot")
  396. #sanity check
  397. if word==None:
  398. return False
  399. #make sure it's really installed on disk
  400. word_path = word.GetValue("Path") + "winword.exe"
  401. return File.Exists(word_path)
  402. #------------------------------------------------------------------------------
  403. def CreateExcelApplication():
  404. #TODO: why is there use of the GUID here?
  405. #import clr
  406. #typelib = clr.LoadTypeLibrary(System.Guid("00020813-0000-0000-C000-000000000046"))
  407. #return typelib.Excel.Application()
  408. import System
  409. type = System.Type.GetTypeFromProgID("Excel.Application")
  410. return System.Activator.CreateInstance(type)
  411. #------------------------------------------------------------------------------
  412. def CreateWordApplication():
  413. import System
  414. #import clr
  415. #typelib = clr.LoadTypeLibrary(System.Guid("00020905-0000-0000-C000-000000000046"))
  416. #return typelib.Word.Application()
  417. type = System.Type.GetTypeFromProgID("Word.Application")
  418. return System.Activator.CreateInstance(type)
  419. #------------------------------------------------------------------------------
  420. def CreateAgentServer():
  421. import clr
  422. from System import Guid
  423. typelib = clr.LoadTypeLibrary(Guid("A7B93C73-7B81-11D0-AC5F-00C04FD97575"))
  424. return typelib.AgentServerObjects.AgentServer()
  425. #------------------------------------------------------------------------------
  426. def CreateDlrComServer():
  427. com_type_name = "DlrComLibrary.DlrComServer"
  428. if is_cli:
  429. com_obj = getRCWFromProgID(com_type_name)
  430. else:
  431. com_obj = win32com.client.Dispatch(com_type_name)
  432. return com_obj
  433. #------------------------------------------------------------------------------
  434. def getTypeFromProgID(prog_id):
  435. '''
  436. Returns the Type object for prog_id.
  437. '''
  438. return Type.GetTypeFromProgID(prog_id)
  439. #------------------------------------------------------------------------------
  440. def getRCWFromProgID(prog_id):
  441. '''
  442. Returns an instance of prog_id.
  443. '''
  444. if is_cli:
  445. return Activator.CreateInstance(getTypeFromProgID(prog_id))
  446. else:
  447. return win32com.client.Dispatch(prog_id)
  448. #------------------------------------------------------------------------------
  449. def genPeverifyInteropAsm(file):
  450. #if this isn't a test run that will invoke peverify there's no point in
  451. #continuing
  452. if not is_peverify_run:
  453. return
  454. else:
  455. mod_name = file.rsplit("\\", 1)[1].split(".py")[0]
  456. print "Generating interop assemblies for the", mod_name, "test module which are needed in %TEMP% by peverify..."
  457. from System.IO import Path
  458. tempDir = Path.GetTempPath()
  459. cwd = nt.getcwd()
  460. #maps COM interop test module names to a list of DLLs
  461. module_dll_dict = {
  462. "excel" : [],
  463. "msagent" : [agentsvr_path],
  464. "scriptpw" : [scriptpw_path],
  465. "word" : [],
  466. }
  467. dlrcomlib_list = [ "dlrcomserver", "paramsinretval", "method", "obj", "prop", ]
  468. if is_cli32:
  469. temp_name = testpath.rowan_root + "\\Test\\DlrComLibrary\\Debug\\DlrComLibrary.dll"
  470. else:
  471. temp_name = testpath.rowan_root + "\\Test\\DlrComLibrary\\x64\\Release\\DlrComLibrary.dll"
  472. for mod_name in dlrcomlib_list: module_dll_dict[mod_name] = [ temp_name ]
  473. if not file_exists_in_path("tlbimp.exe"):
  474. print "ERROR: tlbimp.exe is not in the path!"
  475. sys.exit(1)
  476. try:
  477. if not module_dll_dict.has_key(mod_name):
  478. print "WARNING: cannot determine which interop assemblies to install!"
  479. print " This may affect peverify runs adversely."
  480. print
  481. return
  482. else:
  483. nt.chdir(tempDir)
  484. for com_dll in module_dll_dict[mod_name]:
  485. if not file_exists(com_dll):
  486. print "\tERROR: %s does not exist!" % (com_dll)
  487. continue
  488. print "\trunning tlbimp on", com_dll
  489. run_tlbimp(com_dll)
  490. finally:
  491. nt.chdir(cwd)
  492. #------------------------------------------------------------------------------
  493. #--Fake parts of System for compat tests
  494. if sys.platform=="win32":
  495. class System:
  496. class Byte(int):
  497. MinValue = 0
  498. MaxValue = 255
  499. class SByte(int):
  500. MinValue = -128
  501. MaxValue = 127
  502. class Int16(int):
  503. MinValue = -32768
  504. MaxValue = 32767
  505. class UInt16(int):
  506. MinValue = 0
  507. MaxValue = 65535
  508. class Int32(int):
  509. MinValue = -2147483648
  510. MaxValue = 2147483647
  511. class UInt32(long):
  512. MinValue = 0
  513. MaxValue = 4294967295
  514. class Int64(long):
  515. MinValue = -9223372036854775808L
  516. MaxValue = 9223372036854775807L
  517. class UInt64(long):
  518. MinValue = 0L
  519. MaxValue = 18446744073709551615
  520. class Single(float):
  521. MinValue = -3.40282e+038
  522. MaxValue = 3.40282e+038
  523. class Double(float):
  524. MinValue = -1.79769313486e+308
  525. MaxValue = 1.79769313486e+308
  526. class String(str):
  527. pass
  528. class Boolean(int):
  529. pass
  530. #------------------------------------------------------------------------------
  531. def run_com_test(name, file):
  532. run_test(name)
  533. genPeverifyInteropAsm(file)