[pygccxml-commit] SF.net SVN: pygccxml: [1294] pyplusplus_dev/unittests
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2008-04-01 19:05:44
|
Revision: 1294 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1294&view=rev Author: roman_yakovenko Date: 2008-04-01 12:05:50 -0700 (Tue, 01 Apr 2008) Log Message: ----------- adding new test cases Modified Paths: -------------- pyplusplus_dev/unittests/data/override_bug_to_be_exported.hpp pyplusplus_dev/unittests/override_bug_tester.py Modified: pyplusplus_dev/unittests/data/override_bug_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/override_bug_to_be_exported.hpp 2008-03-31 16:18:12 UTC (rev 1293) +++ pyplusplus_dev/unittests/data/override_bug_to_be_exported.hpp 2008-04-01 19:05:50 UTC (rev 1294) @@ -13,8 +13,11 @@ class A { public: + virtual int foo() const {return int('a');} int foo( int a, int b ) { return a + b;} + + int ddd(){ return 111;} virtual ~A(){} }; @@ -22,6 +25,12 @@ { }; +class D: public B +{ +public: + int foo( int a, int b ){ return a*b; } +}; + inline int invoke_foo( const A& a ){ return a.foo(); }; @@ -88,7 +97,7 @@ void do_nothing() {} }; -} +} #endif//__final_classes_to_be_exported_hpp__ Modified: pyplusplus_dev/unittests/override_bug_tester.py =================================================================== --- pyplusplus_dev/unittests/override_bug_tester.py 2008-03-31 16:18:12 UTC (rev 1293) +++ pyplusplus_dev/unittests/override_bug_tester.py 2008-04-01 19:05:50 UTC (rev 1294) @@ -11,9 +11,9 @@ class tester_t(fundamental_tester_base.fundamental_tester_base_t): EXTENSION_NAME = 'override_bug' - + def __init__( self, *args ): - fundamental_tester_base.fundamental_tester_base_t.__init__( + fundamental_tester_base.fundamental_tester_base_t.__init__( self , tester_t.EXTENSION_NAME , *args ) @@ -26,15 +26,15 @@ do_smth = mb.mem_fun( '::override_bug::BB::do_smth' ) do_smth.add_transformation( FT.output(0), FT.output(1), alias='do_smth_b' ) mb.class_( 'XX' ).mem_fun( 'do_smth' ).exclude() - - def run_tests(self, module): + + def run_tests(self, module): class C( module.B ): def __init__( self ): module.B.__init__( self ) def foo( self ): return ord( 'c' ) self.failUnless( ord('c') == module.invoke_foo( C() ) ) - + class Derived4(module.Derived3): def __init__( self ): module.Derived3.__init__( self ) @@ -42,14 +42,14 @@ return 3 def eval_c(self): return 300 # ignored because eval_c excluded - + self.failUnless( 22223 == module.eval( Derived4() ) ) - + bb = module.BB() print dir( bb ) x = bb.do_smth_b() self.failUnless( x[0] == x[1] == ord( 'b' ) ) - + # Notes: # would return 22222 before any patch, since Derived3 wouldn't have a wrapper # would return 22123 with my original "ignore" handling and a list @@ -58,9 +58,15 @@ # would return ????3 (1s in some locations and 2s in others because of # hashing) if set wouldn't be replaced by a list # would return 11113 if protected virtual methods wouldn't be included + + b = module.B() + self.failUnless( 7 == b.foo( 3,4)) + d = module.D() + self.failUnless( 12 == d.foo(3,4) ) + def create_suite(): - suite = unittest.TestSuite() + suite = unittest.TestSuite() suite.addTest( unittest.makeSuite(tester_t)) return suite This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |