[pygccxml-commit] SF.net SVN: pygccxml:[1775] pyplusplus_dev/unittests
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2009-11-16 19:37:48
|
Revision: 1775 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1775&view=rev Author: roman_yakovenko Date: 2009-11-16 19:37:39 +0000 (Mon, 16 Nov 2009) Log Message: ----------- adding new test case Modified Paths: -------------- pyplusplus_dev/unittests/test_all.py Added Paths: ----------- pyplusplus_dev/unittests/data/indexing_suites2_support_to_be_exported.hpp pyplusplus_dev/unittests/indexing_suites2_support_tester.py Added: pyplusplus_dev/unittests/data/indexing_suites2_support_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/indexing_suites2_support_to_be_exported.hpp (rev 0) +++ pyplusplus_dev/unittests/data/indexing_suites2_support_to_be_exported.hpp 2009-11-16 19:37:39 UTC (rev 1775) @@ -0,0 +1,21 @@ +// 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 __indexing_suites2_to_be_exported_hpp__ +#define __indexing_suites2_to_be_exported_hpp__ + +#include <vector> + +struct foo{ + int bar; +}; + +typedef std::vector< foo > foo_vector; + +foo_vector get_foos(){ + return foo_vector(); +} + +#endif//__indexing_suites2_to_be_exported_hpp__ Added: pyplusplus_dev/unittests/indexing_suites2_support_tester.py =================================================================== --- pyplusplus_dev/unittests/indexing_suites2_support_tester.py (rev 0) +++ pyplusplus_dev/unittests/indexing_suites2_support_tester.py 2009-11-16 19:37:39 UTC (rev 1775) @@ -0,0 +1,48 @@ +# 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 module_builder + + +class tester_t(fundamental_tester_base.fundamental_tester_base_t): + EXTENSION_NAME = 'indexing_suites2_support' + + def __init__( self, *args ): + fundamental_tester_base.fundamental_tester_base_t.__init__( + self + , tester_t.EXTENSION_NAME + , indexing_suite_version=2 + , *args) + + def customize(self, generator): + fvector = generator.global_ns.typedef( 'foo_vector' ) + fvector = declarations.remove_declarated( fvector.type ) + fvector.indexing_suite.call_policies \ + = module_builder.call_policies.return_internal_reference() + + def run_tests( self, module): + v = module.foo_vector() + f = module.foo() + f.bar = 0 + v.append(f) + self.failUnless( v[0].bar == 0 ) + v[0].bar = 10 + self.failUnless( v[0].bar == 10 ) + +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-11-05 22:56:49 UTC (rev 1774) +++ pyplusplus_dev/unittests/test_all.py 2009-11-16 19:37:39 UTC (rev 1775) @@ -120,7 +120,8 @@ import function_adaptor_tester import selection_bug_tester #import ogre_generate_tester -import ft_from_address +import ft_from_address +import indexing_suites2_support_tester testers = [ algorithms_tester @@ -229,7 +230,8 @@ , return_ref_to_ptr_tester , function_adaptor_tester , selection_bug_tester - , ft_from_address + , ft_from_address + , indexing_suites2_support_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. |