[pygccxml-commit] SF.net SVN: pygccxml: [362] pyplusplus_dev/unittests
Brought to you by:
mbaas,
roman_yakovenko
From: <al...@us...> - 2006-07-29 12:39:28
|
Revision: 362 Author: allenb Date: 2006-07-29 05:36:51 -0700 (Sat, 29 Jul 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=362&view=rev Log Message: ----------- Fix spelling error Modified Paths: -------------- pyplusplus_dev/unittests/test_all.py Added Paths: ----------- pyplusplus_dev/unittests/data/temporary_variable_to_be_exported.hpp pyplusplus_dev/unittests/temporary_variable_tester.py Removed Paths: ------------- pyplusplus_dev/unittests/data/temprorary_variable_to_be_exported.hpp pyplusplus_dev/unittests/temprorary_variable_tester.py Copied: pyplusplus_dev/unittests/data/temporary_variable_to_be_exported.hpp (from rev 361, pyplusplus_dev/unittests/data/temprorary_variable_to_be_exported.hpp) =================================================================== --- pyplusplus_dev/unittests/data/temporary_variable_to_be_exported.hpp (rev 0) +++ pyplusplus_dev/unittests/data/temporary_variable_to_be_exported.hpp 2006-07-29 12:36:51 UTC (rev 362) @@ -0,0 +1,90 @@ +// Copyright 2004 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) + +#ifndef __temporary_variable_to_be_exported_hpp__ +#define __temporary_variable_to_be_exported_hpp__ + +#include <string> + +namespace temporary_variables{ + +struct named_item_t{ + + named_item_t() : m_name( "no name" ) {} + + virtual const + std::string& name() const + { return m_name; } + +private: + std::string m_name; +}; + +const std::string& get_name( const named_item_t& ni ){ + return ni.name(); +} + +struct pure_virtual_t{ + virtual const std::string& name() const = 0; + virtual std::string& name_ref() = 0; +}; + + +const std::string& get_name( const pure_virtual_t& ni ){ + return ni.name(); +} + +std::string& get_name_ref( pure_virtual_t& ni ){ + return ni.name_ref(); +} + + +struct virtual_t{ + + virtual_t() : m_name( "no name" ){} + virtual const std::string& name() const { return m_name; } + virtual std::string& name_ref() { return m_name; } + +protected: + + virtual const std::string& name_protected() const { return m_name; } + +private: + + virtual const std::string& name_private() const { return m_name; } + +public: + + std::string m_name; +}; + +struct virtual2_t{ + virtual2_t() : m_name( "no name" ){} +protected: + + virtual const std::string& name_protected_pure() const = 0; + virtual const std::string& name_protected() const { return m_name; } + +private: + + virtual const std::string& name_private_pure() const = 0; + virtual const std::string& name_private() const { return m_name; } + +public: + + std::string m_name; +}; + +const std::string& get_name( const virtual_t& ni ){ + return ni.name(); +} + +std::string& get_name_ref( virtual_t& ni ){ + return ni.name_ref(); +} + +} + +#endif//__temporary_variable_to_be_exported_hpp__ Deleted: pyplusplus_dev/unittests/data/temprorary_variable_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/temprorary_variable_to_be_exported.hpp 2006-07-29 11:58:39 UTC (rev 361) +++ pyplusplus_dev/unittests/data/temprorary_variable_to_be_exported.hpp 2006-07-29 12:36:51 UTC (rev 362) @@ -1,90 +0,0 @@ -// Copyright 2004 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) - -#ifndef __temprorary_variable_to_be_exported_hpp__ -#define __temprorary_variable_to_be_exported_hpp__ - -#include <string> - -namespace temprorary_variables{ - -struct named_item_t{ - - named_item_t() : m_name( "no name" ) {} - - virtual const - std::string& name() const - { return m_name; } - -private: - std::string m_name; -}; - -const std::string& get_name( const named_item_t& ni ){ - return ni.name(); -} - -struct pure_virtual_t{ - virtual const std::string& name() const = 0; - virtual std::string& name_ref() = 0; -}; - - -const std::string& get_name( const pure_virtual_t& ni ){ - return ni.name(); -} - -std::string& get_name_ref( pure_virtual_t& ni ){ - return ni.name_ref(); -} - - -struct virtual_t{ - - virtual_t() : m_name( "no name" ){} - virtual const std::string& name() const { return m_name; } - virtual std::string& name_ref() { return m_name; } - -protected: - - virtual const std::string& name_protected() const { return m_name; } - -private: - - virtual const std::string& name_private() const { return m_name; } - -public: - - std::string m_name; -}; - -struct virtual2_t{ - virtual2_t() : m_name( "no name" ){} -protected: - - virtual const std::string& name_protected_pure() const = 0; - virtual const std::string& name_protected() const { return m_name; } - -private: - - virtual const std::string& name_private_pure() const = 0; - virtual const std::string& name_private() const { return m_name; } - -public: - - std::string m_name; -}; - -const std::string& get_name( const virtual_t& ni ){ - return ni.name(); -} - -std::string& get_name_ref( virtual_t& ni ){ - return ni.name_ref(); -} - -} - -#endif//__temprorary_variable_to_be_exported_hpp__ Copied: pyplusplus_dev/unittests/temporary_variable_tester.py (from rev 361, pyplusplus_dev/unittests/temprorary_variable_tester.py) =================================================================== --- pyplusplus_dev/unittests/temporary_variable_tester.py (rev 0) +++ pyplusplus_dev/unittests/temporary_variable_tester.py 2006-07-29 12:36:51 UTC (rev 362) @@ -0,0 +1,78 @@ +# Copyright 2004 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 pyplusplus import code_creators +from pyplusplus import module_builder + +class tester_t(fundamental_tester_base.fundamental_tester_base_t): + EXTENSION_NAME = 'temporary_variable' + + def __init__( self, *args ): + fundamental_tester_base.fundamental_tester_base_t.__init__( + self + , tester_t.EXTENSION_NAME + , *args ) + + def customize(self, mb): + functions = mb.calldefs( lambda decl: not decl.call_policies + and 'name' in decl.alias ) + functions.call_policies \ + = module_builder.call_policies.return_value_policy( module_builder.call_policies.copy_non_const_reference ) + + def _create_derived_from_named_item(self, extmodule): + class apple_t( extmodule.named_item_t ): + def __init__( self ): + extmodule.named_item_t.__init__( self ) + def name( self ): #this function will be never called + return "apple" + return apple_t() + + def _create_derived_from_pure_virtual(self, extmodule): + class python_pure_virtual_t( extmodule.pure_virtual_t ): + def __init__( self ): + extmodule.pure_virtual_t.__init__( self ) + def name( self ): #this function will be never called + return "name" + def name_ref( self ): #this function will be never called + return "name_ref" + return python_pure_virtual_t() + + def _create_derived_from_virtual(self, extmodule): + class python_virtual_t( extmodule.virtual_t ): + def __init__( self ): + extmodule.virtual_t.__init__( self ) + def name( self ): #this function will be never called + return "name" + def name_ref( self ): #this function will be never called + return "name_ref" + return python_virtual_t() + + def run_tests(self, extmodule): + apple = self._create_derived_from_named_item( extmodule ) + self.failUnless( extmodule.get_name( apple ) == 'no name' ) + pv = self._create_derived_from_pure_virtual( extmodule ) + + self.failIfNotRaisesAny( extmodule.get_name, pv ) + self.failIfNotRaisesAny( extmodule.get_name_ref, pv ) + + virtual = self._create_derived_from_virtual( extmodule ) + self.failUnless( extmodule.get_name( virtual ) == 'no name' ) + self.failUnless( extmodule.get_name_ref( virtual ) == 'no name' ) + + +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() Deleted: pyplusplus_dev/unittests/temprorary_variable_tester.py =================================================================== --- pyplusplus_dev/unittests/temprorary_variable_tester.py 2006-07-29 11:58:39 UTC (rev 361) +++ pyplusplus_dev/unittests/temprorary_variable_tester.py 2006-07-29 12:36:51 UTC (rev 362) @@ -1,78 +0,0 @@ -# Copyright 2004 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 pyplusplus import code_creators -from pyplusplus import module_builder - -class tester_t(fundamental_tester_base.fundamental_tester_base_t): - EXTENSION_NAME = 'temprorary_variable' - - def __init__( self, *args ): - fundamental_tester_base.fundamental_tester_base_t.__init__( - self - , tester_t.EXTENSION_NAME - , *args ) - - def customize(self, mb): - functions = mb.calldefs( lambda decl: not decl.call_policies - and 'name' in decl.alias ) - functions.call_policies \ - = module_builder.call_policies.return_value_policy( module_builder.call_policies.copy_non_const_reference ) - - def _create_derived_from_named_item(self, extmodule): - class apple_t( extmodule.named_item_t ): - def __init__( self ): - extmodule.named_item_t.__init__( self ) - def name( self ): #this function will be never called - return "apple" - return apple_t() - - def _create_derived_from_pure_virtual(self, extmodule): - class python_pure_virtual_t( extmodule.pure_virtual_t ): - def __init__( self ): - extmodule.pure_virtual_t.__init__( self ) - def name( self ): #this function will be never called - return "name" - def name_ref( self ): #this function will be never called - return "name_ref" - return python_pure_virtual_t() - - def _create_derived_from_virtual(self, extmodule): - class python_virtual_t( extmodule.virtual_t ): - def __init__( self ): - extmodule.virtual_t.__init__( self ) - def name( self ): #this function will be never called - return "name" - def name_ref( self ): #this function will be never called - return "name_ref" - return python_virtual_t() - - def run_tests(self, extmodule): - apple = self._create_derived_from_named_item( extmodule ) - self.failUnless( extmodule.get_name( apple ) == 'no name' ) - pv = self._create_derived_from_pure_virtual( extmodule ) - - self.failIfNotRaisesAny( extmodule.get_name, pv ) - self.failIfNotRaisesAny( extmodule.get_name_ref, pv ) - - virtual = self._create_derived_from_virtual( extmodule ) - self.failUnless( extmodule.get_name( virtual ) == 'no name' ) - self.failUnless( extmodule.get_name_ref( virtual ) == 'no name' ) - - -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() \ No newline at end of file Modified: pyplusplus_dev/unittests/test_all.py =================================================================== --- pyplusplus_dev/unittests/test_all.py 2006-07-29 11:58:39 UTC (rev 361) +++ pyplusplus_dev/unittests/test_all.py 2006-07-29 12:36:51 UTC (rev 362) @@ -32,7 +32,7 @@ import special_operators_tester import module_properties_tester import internal_classes_tester -import temprorary_variable_tester +import temporary_variable_tester import recursive_tester import class_order_tester import class_order2_tester @@ -85,7 +85,7 @@ , special_operators_tester , module_properties_tester , internal_classes_tester - , temprorary_variable_tester + , temporary_variable_tester , recursive_tester , class_order_tester , noncopyable_tester @@ -133,4 +133,4 @@ print str( error ) print 'first argument should be integer, it says how many times to run tests.' - run_suite(times) \ No newline at end of file + run_suite(times) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |