[pygccxml-commit] SF.net SVN: pygccxml: [671] pyplusplus_dev/unittests
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2006-10-18 21:22:12
|
Revision: 671 http://svn.sourceforge.net/pygccxml/?rev=671&view=rev Author: roman_yakovenko Date: 2006-10-18 14:22:05 -0700 (Wed, 18 Oct 2006) Log Message: ----------- adding new test case for indexing suite v2 Modified Paths: -------------- pyplusplus_dev/unittests/data/indexing_suites2_to_be_exported.hpp pyplusplus_dev/unittests/indexing_suites2_tester.py Modified: pyplusplus_dev/unittests/data/indexing_suites2_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/indexing_suites2_to_be_exported.hpp 2006-10-18 18:54:05 UTC (rev 670) +++ pyplusplus_dev/unittests/data/indexing_suites2_to_be_exported.hpp 2006-10-18 21:22:05 UTC (rev 671) @@ -1,21 +1,21 @@ -// 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 __indexing_suites2_to_be_exported_hpp__ -#define __indexing_suites2_to_be_exported_hpp__ +// 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 __indexing_suites2_to_be_exported_hpp__ +#define __indexing_suites2_to_be_exported_hpp__ + #include <vector> -#include <string> +#include <string> #include <map> - -namespace indexing_suites2 { - -typedef std::vector< std::string > strings_t; - -inline void do_nothing( const strings_t& ){} +namespace indexing_suites2 { + +typedef std::vector< std::string > strings_t; + +inline void do_nothing( const strings_t& ){} + struct item_t{ item_t() : value( -1 ){} @@ -28,11 +28,16 @@ } int value; -}; +}; - -typedef std::vector<item_t> items_t; +typedef std::vector<item_t> items_t; + +typedef std::vector<item_t*> items_ptr_t; +inline items_ptr_t create_items_ptr(){ + return items_ptr_t(); +} + inline item_t get_value( const std::vector<item_t>& vec, unsigned int index ){ return vec.at(index); } @@ -41,10 +46,10 @@ vec.at(index); vec[index] = value; } - -typedef std::vector<float> fvector; -fvector empty_fvector(){ return fvector(); } +typedef std::vector<float> fvector; +fvector empty_fvector(){ return fvector(); } + typedef std::map< std::string, std::string > name2value_t; inline std::string get_first_name( name2value_t const * names ){ if( !names ){ @@ -54,7 +59,7 @@ return names->begin()->first; } } - -} - -#endif//__indexing_suites2_to_be_exported_hpp__ + +} + +#endif//__indexing_suites2_to_be_exported_hpp__ \ No newline at end of file Modified: pyplusplus_dev/unittests/indexing_suites2_tester.py =================================================================== --- pyplusplus_dev/unittests/indexing_suites2_tester.py 2006-10-18 18:54:05 UTC (rev 670) +++ pyplusplus_dev/unittests/indexing_suites2_tester.py 2006-10-18 21:22:05 UTC (rev 671) @@ -27,6 +27,10 @@ fvector.indexing_suite.disable_method( 'extend' ) fvector.indexing_suite.disable_methods_group( 'reorder' ) #fvector.indexing_suite.call_policies = module_builder.call_policies.default_call_policies() + items_ptr = generator.global_ns.typedef( 'items_ptr_t' ) + items_ptr = declarations.remove_declarated( items_ptr.type ) + items_ptr.indexing_suite.call_policies = module_builder.call_policies.return_internal_reference() + def run_tests( self, module): fv = module.fvector() @@ -43,7 +47,10 @@ name2value = module.name2value_t() name2value[ "x" ] = "y" self.failUnless( "x" == module.get_first_name( name2value ) ) - + items_ptr = module.items_ptr_t() + items_ptr.append( item ) + self.failUnless( items_ptr[0].value == 1977 ) + print 'xx' 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. |