[pygccxml-commit] SF.net SVN: pygccxml: [864] pygccxml_dev/unittests
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2007-01-10 06:38:44
|
Revision: 864 http://svn.sourceforge.net/pygccxml/?rev=864&view=rev Author: roman_yakovenko Date: 2007-01-09 22:38:42 -0800 (Tue, 09 Jan 2007) Log Message: ----------- add new test case Modified Paths: -------------- pygccxml_dev/unittests/data/patcher.hpp pygccxml_dev/unittests/patcher_tester.py Modified: pygccxml_dev/unittests/data/patcher.hpp =================================================================== --- pygccxml_dev/unittests/data/patcher.hpp 2007-01-09 21:24:49 UTC (rev 863) +++ pygccxml_dev/unittests/data/patcher.hpp 2007-01-10 06:38:42 UTC (rev 864) @@ -6,6 +6,8 @@ #ifndef __patcher_hpp__ #define __patcher_hpp__ +#include <vector> + namespace ns1{ namespace ns2{ enum fruit{ apple, orange }; @@ -45,6 +47,11 @@ void typedef__func( const typedef_::alias& position = typedef_::alias() ); +namespace osg{ + struct node{}; + node* clone_tree( const std::vector<std::string> &types=std::vector<std::string>() ); + +} /*struct default_arg_t{};*/ /*default_arg_t create_default_argument();*/ Modified: pygccxml_dev/unittests/patcher_tester.py =================================================================== --- pygccxml_dev/unittests/patcher_tester.py 2007-01-09 21:24:49 UTC (rev 863) +++ pygccxml_dev/unittests/patcher_tester.py 2007-01-10 06:38:42 UTC (rev 864) @@ -13,60 +13,56 @@ from pygccxml import declarations class tester_impl_t( parser_test_case.parser_test_case_t ): - - decls = None - + def __init__(self, architecture, *args): parser_test_case.parser_test_case_t.__init__(self, *args) self.architecture = architecture - self.__decls = None + self.global_ns = None def setUp( self ): reader = parser.source_reader_t( self.config ) if 32 == self.architecture: - self.__decls = reader.read_file( 'patcher.hpp' ) + self.global_ns = reader.read_file( 'patcher.hpp' )[0].top_parent else: original_get_architecture = utils.get_architecture utils.get_architecture = lambda: 64 - self.__decls = reader.read_xml_file( - os.path.join( autoconfig.data_directory, 'patcher_tester_64bit.xml' ) ) + self.global_ns = reader.read_xml_file( + os.path.join( autoconfig.data_directory, 'patcher_tester_64bit.xml' ) )[0].top_parent utils.get_architecture = original_get_architecture def test_enum_patcher(self): - fix_enum = declarations.find_declaration( self.__decls, type=declarations.free_function_t, name='fix_enum' ) - self.failUnless( fix_enum, "Free function fix_enum has not been found." ) + fix_enum = self.global_ns.free_fun( 'fix_enum' ) self.failUnless( fix_enum.arguments[0].default_value == '::ns1::ns2::apple' ) #double_call = declarations.find_declaration( decls, type=declarations.free_function_t, name='double_call' ) def test_numeric_patcher(self): - fix_numeric = declarations.find_declaration( self.__decls, type=declarations.free_function_t, name='fix_numeric' ) - self.failUnless( fix_numeric, "Free function fix_numeric has not been found." ) + fix_numeric = self.global_ns.free_fun( 'fix_numeric' ) if 32 == self.architecture: self.failUnless( fix_numeric.arguments[0].default_value == u"0xffffffffffffffff" ) else: self.failUnless( fix_numeric.arguments[0].default_value == u"0ffffffff" ) def test_unnamed_enum_patcher(self): - fix_unnamed = declarations.find_declaration( self.__decls, type=declarations.free_function_t, name='fix_unnamed' ) - self.failUnless( fix_unnamed, "Free function fix_unnamed has not been found." ) + fix_unnamed = self.global_ns.free_fun( 'fix_unnamed' ) self.failUnless( fix_unnamed.arguments[0].default_value == u"int(::fx::unnamed)" ) def test_function_call_patcher(self): - fix_function_call = declarations.find_declaration( self.__decls, type=declarations.free_function_t, name='fix_function_call' ) - self.failUnless( fix_function_call, "Free function fix_function_call has not been found." ) + fix_function_call = self.global_ns.free_fun( 'fix_function_call' ) self.failUnless( fix_function_call.arguments[0].default_value == u"function_call::calc( 1, 2, 3 )" ) def test_fundamental_patcher(self): - fcall = declarations.find_declaration( self.__decls, type=declarations.free_function_t, name='fix_fundamental' ) - self.failUnless( fcall, "Free function fix_function_call has not been found." ) + fcall = self.global_ns.free_fun( 'fix_fundamental' ) self.failUnless( fcall.arguments[0].default_value == u"(unsigned int)(::fundamental::eggs)" ) def test_constructor_patcher(self): - typedef__func = declarations.find_declaration( self.__decls, type=declarations.free_function_t, name='typedef__func' ) - self.failUnless( typedef__func, "Free function typedef__func has not been found." ) + typedef__func = self.global_ns.free_fun( 'typedef__func' ) self.failUnless( typedef__func.arguments[0].default_value == u"::typedef_::alias( )" ) - + if 32 == self.architecture: + clone_tree = self.global_ns.free_fun( 'clone_tree' ) + default_value = '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> > > >()' + self.failUnless( default_value == clone_tree.arguments[0].default_value ) + class tester_32_t( tester_impl_t ): def __init__(self, *args): tester_impl_t.__init__(self, 32, *args) @@ -85,4 +81,4 @@ unittest.TextTestRunner(verbosity=2).run( create_suite() ) if __name__ == "__main__": - run_suite() \ No newline at end of file + run_suite() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |