55
66import os
77import unittest
8+ import platform
89import autoconfig
910import parser_test_case
1011
@@ -17,7 +18,7 @@ def __init__(self, architecture, *args):
1718 parser_test_case .parser_test_case_t .__init__ (self , * args )
1819 self .architecture = architecture
1920 self .global_ns = None
20-
21+
2122 def test_enum_patcher (self ):
2223 fix_enum = self .global_ns .free_fun ( 'fix_enum' )
2324 self .failUnless ( fix_enum .arguments [0 ].default_value == '::ns1::ns2::apple' )
@@ -28,12 +29,19 @@ def test_numeric_patcher(self):
2829 fix_numeric = self .global_ns .free_fun ( 'fix_numeric' )
2930 if 32 == self .architecture :
3031 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 )
3238 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+
3745 def test_unnamed_enum_patcher (self ):
3846 fix_unnamed = self .global_ns .free_fun ( 'fix_unnamed' )
3947 self .failUnless ( fix_unnamed .arguments [0 ].default_value == u"int(::fx::unnamed)" )
@@ -65,19 +73,19 @@ def test_constructor_patcher(self):
6573 default_values = [
6674 '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> > > >()'
6775 , '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+ ]
6977 self .failUnless ( clone_tree .arguments [0 ].default_value in default_values )
70-
78+
7179class tester_32_t ( tester_impl_t ):
72- global_ns = None
80+ global_ns = None
7381 def __init__ (self , * args ):
7482 tester_impl_t .__init__ (self , 32 , * args )
7583
7684 def setUp ( self ):
7785 if not tester_32_t .global_ns :
7886 reader = parser .source_reader_t ( self .config )
7987 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
8189
8290
8391class tester_64_t ( tester_impl_t ):
@@ -92,17 +100,17 @@ def setUp( self ):
92100
93101 if not tester_64_t .global_ns :
94102 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 (
96104 os .path .join ( autoconfig .data_directory , 'patcher_tester_64bit.xml' ) )[0 ].top_parent
97105 self .global_ns = tester_64_t .global_ns
98-
106+
99107 def tearDown ( self ):
100108 utils .get_architecture = self .original_get_architecture
101109
102110def 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 ))
106114 return suite
107115
108116def run_suite ():
0 commit comments