5
5
6
6
import os
7
7
import unittest
8
+ import platform
8
9
import autoconfig
9
10
import parser_test_case
10
11
@@ -17,7 +18,7 @@ def __init__(self, architecture, *args):
17
18
parser_test_case .parser_test_case_t .__init__ (self , * args )
18
19
self .architecture = architecture
19
20
self .global_ns = None
20
-
21
+
21
22
def test_enum_patcher (self ):
22
23
fix_enum = self .global_ns .free_fun ( 'fix_enum' )
23
24
self .failUnless ( fix_enum .arguments [0 ].default_value == '::ns1::ns2::apple' )
@@ -28,12 +29,19 @@ def test_numeric_patcher(self):
28
29
fix_numeric = self .global_ns .free_fun ( 'fix_numeric' )
29
30
if 32 == self .architecture :
30
31
if '0.9' in fix_numeric .compiler :
31
- self .failUnless ( fix_numeric .arguments [0 ].default_value == u"0xffffffffffffffffu" )
32
+ if platform .machine () == 'x86_64' :
33
+ self .failUnless ( fix_numeric .arguments [0 ].default_value == u"-1u"
34
+ , fix_numeric .arguments [0 ].default_value )
35
+ else :
36
+ self .failUnless ( fix_numeric .arguments [0 ].default_value == u"0xffffffffffffffffu"
37
+ , fix_numeric .arguments [0 ].default_value )
32
38
else :
33
- self .failUnless ( fix_numeric .arguments [0 ].default_value == u"0xffffffffffffffff" )
34
- else :
35
- self .failUnless ( fix_numeric .arguments [0 ].default_value == u"0ffffffff" )
36
-
39
+ self .failUnless ( fix_numeric .arguments [0 ].default_value == u"0xffffffffffffffff"
40
+ , fix_numeric .arguments [0 ].default_value )
41
+ else :
42
+ self .failUnless ( fix_numeric .arguments [0 ].default_value == u"0ffffffff"
43
+ , fix_numeric .arguments [0 ].default_value )
44
+
37
45
def test_unnamed_enum_patcher (self ):
38
46
fix_unnamed = self .global_ns .free_fun ( 'fix_unnamed' )
39
47
self .failUnless ( fix_unnamed .arguments [0 ].default_value == u"int(::fx::unnamed)" )
@@ -65,19 +73,19 @@ def test_constructor_patcher(self):
65
73
default_values = [
66
74
'vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >()'
67
75
, 'vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >((&allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >()))'
68
- ]
76
+ ]
69
77
self .failUnless ( clone_tree .arguments [0 ].default_value in default_values )
70
-
78
+
71
79
class tester_32_t ( tester_impl_t ):
72
- global_ns = None
80
+ global_ns = None
73
81
def __init__ (self , * args ):
74
82
tester_impl_t .__init__ (self , 32 , * args )
75
83
76
84
def setUp ( self ):
77
85
if not tester_32_t .global_ns :
78
86
reader = parser .source_reader_t ( self .config )
79
87
tester_32_t .global_ns = reader .read_file ( 'patcher.hpp' )[0 ].top_parent
80
- self .global_ns = tester_32_t .global_ns
88
+ self .global_ns = tester_32_t .global_ns
81
89
82
90
83
91
class tester_64_t ( tester_impl_t ):
@@ -92,17 +100,17 @@ def setUp( self ):
92
100
93
101
if not tester_64_t .global_ns :
94
102
reader = parser .source_reader_t ( self .config )
95
- tester_64_t .global_ns = reader .read_xml_file (
103
+ tester_64_t .global_ns = reader .read_xml_file (
96
104
os .path .join ( autoconfig .data_directory , 'patcher_tester_64bit.xml' ) )[0 ].top_parent
97
105
self .global_ns = tester_64_t .global_ns
98
-
106
+
99
107
def tearDown ( self ):
100
108
utils .get_architecture = self .original_get_architecture
101
109
102
110
def create_suite ():
103
- suite = unittest .TestSuite ()
104
- suite .addTest ( unittest .makeSuite (tester_32_t ))
105
- suite .addTest ( unittest .makeSuite (tester_64_t ))
111
+ suite = unittest .TestSuite ()
112
+ suite .addTest ( unittest .makeSuite (tester_32_t ))
113
+ suite .addTest ( unittest .makeSuite (tester_64_t ))
106
114
return suite
107
115
108
116
def run_suite ():
0 commit comments