[pygccxml-commit] SF.net SVN: pygccxml:[1449] pyplusplus_dev/unittests
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2008-11-01 19:04:15
|
Revision: 1449 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1449&view=rev Author: roman_yakovenko Date: 2008-11-01 19:04:11 +0000 (Sat, 01 Nov 2008) Log Message: ----------- adding new test case Modified Paths: -------------- pyplusplus_dev/unittests/test_all.py Added Paths: ----------- pyplusplus_dev/unittests/data/protected_bug_to_be_exported.hpp pyplusplus_dev/unittests/protected_bug_tester.py Added: pyplusplus_dev/unittests/data/protected_bug_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/protected_bug_to_be_exported.hpp (rev 0) +++ pyplusplus_dev/unittests/data/protected_bug_to_be_exported.hpp 2008-11-01 19:04:11 UTC (rev 1449) @@ -0,0 +1,66 @@ +template<class T> +class ref_ptr +{ +}; + +template<class T> +class buffered_value +{ +public: + buffered_value() {} + buffered_value(unsigned int size) {} + buffered_value& operator = (const buffered_value& rhs) {} +}; + +class Referenced +{ +public: + Referenced() {} + Referenced(const Referenced&) {} +protected: + virtual ~Referenced() {} +}; + +class Object : public Referenced +{ +public: + Object() {} + virtual const char* className() const = 0; + +protected: + virtual ~Object() {} +}; + +class Shader : public Object +{ +public: + + virtual const char* className() const { return "Shader"; } + + Shader() {} + Shader(const char *source ) {} + +protected: + class PerContextShader : public Referenced + { + public: + PerContextShader(const Shader* shader, unsigned int contextID) {} + + protected: + ~PerContextShader() {} + + private: + PerContextShader() {} + PerContextShader(const PerContextShader&) {} + PerContextShader& operator=(const PerContextShader&) {} + }; + +protected: + virtual ~Shader() {} + + PerContextShader* getPCS(unsigned int contextID) const {} + +protected: + mutable buffered_value< ref_ptr<PerContextShader> > _pcsList; +}; + Added: pyplusplus_dev/unittests/protected_bug_tester.py =================================================================== --- pyplusplus_dev/unittests/protected_bug_tester.py (rev 0) +++ pyplusplus_dev/unittests/protected_bug_tester.py 2008-11-01 19:04:11 UTC (rev 1449) @@ -0,0 +1,47 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import os +import sys +import unittest +import fundamental_tester_base +from pygccxml import declarations +from pyplusplus import code_creators + +class tester_t(fundamental_tester_base.fundamental_tester_base_t): + EXTENSION_NAME = 'protected_bug' + + def __init__( self, *args ): + fundamental_tester_base.fundamental_tester_base_t.__init__( + self + , tester_t.EXTENSION_NAME + , *args ) + + def customize(self, mb ): + access_type_matcher = declarations.access_type_matcher_t + mb.global_ns.include() + mb.classes( access_type_matcher('protected') ).exclude() + mb.vars( access_type_matcher('protected') ).exclude() + mb.class_( lambda d: d.name.startswith( 'buffered_value' ) ).exclude() + for cls in mb.classes(): + if declarations.has_destructor(cls) \ + and cls.calldef(lambda d: d.name.startswith('~'), recursive=False).access_type == 'protected': + print 'protected destructor: ', str( cls ) + cls.constructors().exclude() + cls.noncopyable = True + + def run_tests( self, module): + pass + +def create_suite(): + suite = unittest.TestSuite() + suite.addTest( unittest.makeSuite(tester_t)) + return suite + +def run_suite(): + unittest.TextTestRunner(verbosity=2).run( create_suite() ) + +if __name__ == "__main__": + run_suite() Modified: pyplusplus_dev/unittests/test_all.py =================================================================== --- pyplusplus_dev/unittests/test_all.py 2008-11-01 08:09:25 UTC (rev 1448) +++ pyplusplus_dev/unittests/test_all.py 2008-11-01 19:04:11 UTC (rev 1449) @@ -57,6 +57,7 @@ import factory_tester import private_assign_tester import protected_tester +import protected_bug_tester import indexing_suites_tester import indexing_suites2_tester import hierarchy3_tester @@ -206,6 +207,7 @@ , cp_return_addressof_tester , make_constructor_tester , return_auto_ptr_tester + , protected_bug_tester # , ogre_generate_tester too much time ] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |