[pygccxml-commit] SF.net SVN: pygccxml: [640] pyplusplus_dev/unittests
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2006-10-10 19:31:26
|
Revision: 640 http://svn.sourceforge.net/pygccxml/?rev=640&view=rev Author: roman_yakovenko Date: 2006-10-10 12:31:17 -0700 (Tue, 10 Oct 2006) Log Message: ----------- updating unit tests to reflect "template on return type" FAQ Modified Paths: -------------- pyplusplus_dev/unittests/data/member_functions_to_be_exported.cpp pyplusplus_dev/unittests/data/member_functions_to_be_exported.hpp pyplusplus_dev/unittests/data/pointer_as_arg_to_be_exported.hpp pyplusplus_dev/unittests/member_functions_tester.py Modified: pyplusplus_dev/unittests/data/member_functions_to_be_exported.cpp =================================================================== --- pyplusplus_dev/unittests/data/member_functions_to_be_exported.cpp 2006-10-10 13:26:42 UTC (rev 639) +++ pyplusplus_dev/unittests/data/member_functions_to_be_exported.cpp 2006-10-10 19:31:17 UTC (rev 640) @@ -1,10 +1,9 @@ -// 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) - -#include "member_functions_to_be_exported.hpp" - -namespace member_functions{ -} - +// 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) + +#include "member_functions_to_be_exported.hpp" + +namespace member_functions{ +} Modified: pyplusplus_dev/unittests/data/member_functions_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/member_functions_to_be_exported.hpp 2006-10-10 13:26:42 UTC (rev 639) +++ pyplusplus_dev/unittests/data/member_functions_to_be_exported.hpp 2006-10-10 19:31:17 UTC (rev 640) @@ -166,7 +166,17 @@ } }; + +struct mem_fun_environment_t{ + template< class T> + T get_value(const std::string& x){ return T(); } +}; + +inline void instantiate_mem_fun_environment(){ + mem_fun_environment_t env; + int i = env.get_value<int>(""); } +} #endif//__member_functions_to_be_exported_hpp__ Modified: pyplusplus_dev/unittests/data/pointer_as_arg_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/pointer_as_arg_to_be_exported.hpp 2006-10-10 13:26:42 UTC (rev 639) +++ pyplusplus_dev/unittests/data/pointer_as_arg_to_be_exported.hpp 2006-10-10 19:31:17 UTC (rev 640) @@ -1,22 +1,22 @@ -// 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 __pointer_as_arg_to_be_exported_hpp__ -#define __pointer_as_arg_to_be_exported_hpp__ - -#include <string> - -namespace pointer_as_arg{ - +// 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 __pointer_as_arg_to_be_exported_hpp__ +#define __pointer_as_arg_to_be_exported_hpp__ + +#include <string> + +namespace pointer_as_arg{ + struct data{}; inline int test_for_null( data* d=0 ){ return d ? 1 : 0; -} - -} - -#endif//__pointer_as_arg_to_be_exported_hpp__ +} + +} + +#endif//__pointer_as_arg_to_be_exported_hpp__ \ No newline at end of file Modified: pyplusplus_dev/unittests/member_functions_tester.py =================================================================== --- pyplusplus_dev/unittests/member_functions_tester.py 2006-10-10 13:26:42 UTC (rev 639) +++ pyplusplus_dev/unittests/member_functions_tester.py 2006-10-10 19:31:17 UTC (rev 640) @@ -33,7 +33,15 @@ #will reporoduce bug mb.class_('callable_t').always_expose_using_scope = True mb.BOOST_PYTHON_MAX_ARITY = 1 - + mb.free_function( 'instantiate_mem_fun_environment' ).exclude() + + env = mb.class_( 'mem_fun_environment_t' ) + get_value = env.member_function( 'get_value', return_type='int' ) + get_value.alias = 'get_value_int' + get_value.name = get_value.demangled_name + + mb.run_query_optimizer() + def create_py_immutable_by_ref( self, module ): class py_immutable_by_ref( module.immutable_by_ref_t ): def __init__( self ): @@ -120,7 +128,10 @@ x = self.create_py_immutable_by_ref(module) self.failUnless( x.identity( '11' ) == '1111' ) self.failUnless( module.immutable_by_ref_t.call_identity(x, '11') == '1111' ) - + + env = module.mem_fun_environment_t() + env.get_value_int("xxx") + 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. |