[pygccxml-commit] SF.net SVN: pygccxml: [1241] pyplusplus_dev/unittests
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2008-02-17 11:44:43
|
Revision: 1241 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1241&view=rev Author: roman_yakovenko Date: 2008-02-17 03:44:47 -0800 (Sun, 17 Feb 2008) Log Message: ----------- adding new tests 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-02-17 11:43:23 UTC (rev 1240) +++ pyplusplus_dev/unittests/data/override_bug_to_be_exported.hpp 2008-02-17 11:44:47 UTC (rev 1241) @@ -24,6 +24,42 @@ inline int invoke_foo( const A& a ){ return a.foo(); }; + +class Base1 +{ +public: + virtual int eval_a() { return 1; } + virtual int eval_b() { return 10; } + virtual int eval_c() { return 100; } + virtual int eval_d() { return 1000; } + virtual int eval_e() { return 10000; } +}; + +class Derived2: public Base1 +{ +protected: + virtual int eval_a() { return 2; } + virtual int eval_b() { return 20; } + virtual int eval_c() { return 200; } + virtual int eval_d() { return 2000; } + virtual int eval_e() { return 20000; } +}; + +class Derived3: public Derived2 +{ +}; + +int eval(Base1* obj) { + return + obj->eval_a() + + obj->eval_b() + + obj->eval_c() + + obj->eval_d() + + obj->eval_e() + ; +} + + } #endif//__final_classes_to_be_exported_hpp__ Modified: pyplusplus_dev/unittests/override_bug_tester.py =================================================================== --- pyplusplus_dev/unittests/override_bug_tester.py 2008-02-17 11:43:23 UTC (rev 1240) +++ pyplusplus_dev/unittests/override_bug_tester.py 2008-02-17 11:44:47 UTC (rev 1241) @@ -17,6 +17,9 @@ , tester_t.EXTENSION_NAME , *args ) + def customize( self, mb ): + mb.class_("Derived2").member_functions("eval_c").exclude() + def run_tests(self, module): class C( module.B ): def __init__( self ): @@ -24,7 +27,26 @@ 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 ) + def eval_a(self): + return 3 + def eval_c(self): + return 300 # ignored because eval_c excluded + self.failUnless( 22223 == module.eval( Derived4() ) ) + + # 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 + # instead of a set, because eval_c would be excluded naively + # would return 22323 if ignore flag wouldn't be considered + # 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 + def create_suite(): suite = unittest.TestSuite() suite.addTest( unittest.makeSuite(tester_t)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |