[pygccxml-commit] SF.net SVN: pygccxml:[1734] pyplusplus_dev/unittests
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2009-05-17 05:48:52
|
Revision: 1734 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1734&view=rev Author: roman_yakovenko Date: 2009-05-17 05:48:47 +0000 (Sun, 17 May 2009) Log Message: ----------- adding new test case Modified Paths: -------------- pyplusplus_dev/unittests/test_all.py Added Paths: ----------- pyplusplus_dev/unittests/data/return_ref_to_ptr_to_be_exported.hpp pyplusplus_dev/unittests/return_ref_to_ptr_tester.py Added: pyplusplus_dev/unittests/data/return_ref_to_ptr_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/return_ref_to_ptr_to_be_exported.hpp (rev 0) +++ pyplusplus_dev/unittests/data/return_ref_to_ptr_to_be_exported.hpp 2009-05-17 05:48:47 UTC (rev 1734) @@ -0,0 +1,27 @@ +// 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) + +#ifndef __return_ref_to_ptr_to_be_exported_hpp__ +#define __return_ref_to_ptr_to_be_exported_hpp__ + +struct number_t{ + int m_value; +}; + + +struct numbers_t{ + numbers_t() + : m_number( new number_t() ) + {} + + typedef number_t * value_type; + const value_type& operator[]( int index ) const { + return m_number; + } + number_t* m_number; +}; + + +#endif//__return_ref_to_ptr_to_be_exported_hpp__ Added: pyplusplus_dev/unittests/return_ref_to_ptr_tester.py =================================================================== --- pyplusplus_dev/unittests/return_ref_to_ptr_tester.py (rev 0) +++ pyplusplus_dev/unittests/return_ref_to_ptr_tester.py 2009-05-17 05:48:47 UTC (rev 1734) @@ -0,0 +1,37 @@ +# 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 pyplusplus.module_builder import call_policies + +class tester_t(fundamental_tester_base.fundamental_tester_base_t): + EXTENSION_NAME = 'return_ref_to_ptr' + + def __init__( self, *args ): + fundamental_tester_base.fundamental_tester_base_t.__init__( + self + , tester_t.EXTENSION_NAME + , *args ) + + def customize(self, mb ): + mb.class_('numbers_t').operator('[]').call_policies = call_policies.return_internal_reference() + + def run_tests(self, module): + numbers = module.numbers_t() + n = numbers[1] + +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 2009-05-17 04:37:57 UTC (rev 1733) +++ pyplusplus_dev/unittests/test_all.py 2009-05-17 05:48:47 UTC (rev 1734) @@ -116,6 +116,7 @@ import derive_from_deque_tester import std_pair_tester import mem_var_compile_error_bug_tester +import return_ref_to_ptr_tester #import ogre_generate_tester testers = [ @@ -222,6 +223,7 @@ , derive_from_deque_tester , std_pair_tester , mem_var_compile_error_bug_tester + , return_ref_to_ptr_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. |