Thread: [pygccxml-commit] SF.net SVN: pygccxml:[1404] pygccxml_dev/unittests
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2008-08-21 18:02:40
|
Revision: 1404 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1404&view=rev Author: roman_yakovenko Date: 2008-08-21 18:02:50 +0000 (Thu, 21 Aug 2008) Log Message: ----------- add new test cases Modified Paths: -------------- pygccxml_dev/unittests/data/vector_traits.hpp pygccxml_dev/unittests/vector_traits_tester.py Modified: pygccxml_dev/unittests/data/vector_traits.hpp =================================================================== --- pygccxml_dev/unittests/data/vector_traits.hpp 2008-08-21 12:38:47 UTC (rev 1403) +++ pygccxml_dev/unittests/data/vector_traits.hpp 2008-08-21 18:02:50 UTC (rev 1404) @@ -1,9 +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) +// 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 <string> +#include <string> #include <vector> @@ -65,4 +65,6 @@ }; } -} \ No newline at end of file +} + +void do_nothing( std::vector< std::wstring >& ); Modified: pygccxml_dev/unittests/vector_traits_tester.py =================================================================== --- pygccxml_dev/unittests/vector_traits_tester.py 2008-08-21 12:38:47 UTC (rev 1403) +++ pygccxml_dev/unittests/vector_traits_tester.py 2008-08-21 18:02:50 UTC (rev 1404) @@ -59,6 +59,11 @@ cnt = 'std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >@::std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >' traits = declarations.find_container_traits( cnt ) self.failUnless( declarations.vector_traits is traits) + + def test_element_type( self ): + do_nothing = self.global_ns.free_fun( 'do_nothing' ) + v = declarations.remove_reference( declarations.remove_declarated( do_nothing.arguments[0].type )) + declarations.vector_traits.element_type( v ) def create_suite(): suite = unittest.TestSuite() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2008-08-25 18:12:06
|
Revision: 1405 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1405&view=rev Author: roman_yakovenko Date: 2008-08-25 18:12:09 +0000 (Mon, 25 Aug 2008) Log Message: ----------- add new tester to check infinite loop Modified Paths: -------------- pygccxml_dev/unittests/data/indexing_suites2.hpp pygccxml_dev/unittests/find_container_traits_tester.py Modified: pygccxml_dev/unittests/data/indexing_suites2.hpp =================================================================== --- pygccxml_dev/unittests/data/indexing_suites2.hpp 2008-08-21 18:02:50 UTC (rev 1404) +++ pygccxml_dev/unittests/data/indexing_suites2.hpp 2008-08-25 18:12:09 UTC (rev 1405) @@ -85,4 +85,8 @@ typedef std::vector<indexing_suites2::item_t*> items_ptr_t; }} +namespace infinite_loop{ + std::map< std::string, int > test_infinite_loop(); +} + #endif//__indexing_suites2_to_be_exported_hpp__ Modified: pygccxml_dev/unittests/find_container_traits_tester.py =================================================================== --- pygccxml_dev/unittests/find_container_traits_tester.py 2008-08-21 18:02:50 UTC (rev 1404) +++ pygccxml_dev/unittests/find_container_traits_tester.py 2008-08-25 18:12:09 UTC (rev 1405) @@ -65,7 +65,14 @@ x = 'map<std::string, bool (*)(std::string&, Ogre::MaterialScriptContext&), std::less<std::string>, std::allocator<std::pair<std::string const, bool (*)(std::string&, Ogre::MaterialScriptContext&)> > >' ct = declarations.find_container_traits( x ) y = ct.remove_defaults( x ) - + + def test_infinite_loop(self): + rt = self.global_ns.free_fun( 'test_infinite_loop' ).return_type + map_traits = declarations.find_container_traits( rt ) + self.failUnless( map_traits is declarations.map_traits ) + elem = map_traits.element_type( rt ) + self.failUnless( elem.decl_string == 'int' ) + 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. |
From: <rom...@us...> - 2008-08-26 19:01:21
|
Revision: 1409 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1409&view=rev Author: roman_yakovenko Date: 2008-08-26 19:01:31 +0000 (Tue, 26 Aug 2008) Log Message: ----------- adding new test case from Gustavo Carneiro Modified Paths: -------------- pygccxml_dev/unittests/data/remove_template_defaults.hpp pygccxml_dev/unittests/find_container_traits_tester.py Modified: pygccxml_dev/unittests/data/remove_template_defaults.hpp =================================================================== --- pygccxml_dev/unittests/data/remove_template_defaults.hpp 2008-08-26 11:23:56 UTC (rev 1408) +++ pygccxml_dev/unittests/data/remove_template_defaults.hpp 2008-08-26 19:01:31 UTC (rev 1409) @@ -76,6 +76,9 @@ typedef std::map< int, double > m_i2d; typedef std::map< std::wstring, double > m_wstr2d; typedef std::map< const std::vector< int >, m_wstr2d > m_v_i2m_wstr2d; + + inline std::map<std::string, int> f2(){} + } namespace multimaps{ Modified: pygccxml_dev/unittests/find_container_traits_tester.py =================================================================== --- pygccxml_dev/unittests/find_container_traits_tester.py 2008-08-26 11:23:56 UTC (rev 1408) +++ pygccxml_dev/unittests/find_container_traits_tester.py 2008-08-26 19:01:31 UTC (rev 1409) @@ -65,16 +65,25 @@ self.__cmp_traits( 'hmm_i2d', declarations.hash_multimap_traits, "hash_multimap< int, double >", 'int' ) def test_multimap( self ): - mm = self.global_ns.classes( lambda decl: decl.name.startswith( 'multimap' ) ) - for m in mm: - traits = declarations.find_container_traits( m ) - print m.partial_name + m = self.global_ns.class_( lambda decl: decl.name.startswith( 'multimap' ) ) + traits = declarations.find_container_traits( m ) + self.failUness( m.partial_name == 'multimap< int, int >' ) def test_recursive_partial_name( self ): f1 = self.global_ns.free_fun( 'f1' ) t1 = declarations.class_traits.get_declaration( f1.arguments[0].type ) self.failUnless( 'type< std::set< std::vector< int > > >' == t1.partial_name ) + def test_remove_defaults_partial_name_namespace( self ): + f2 = self.global_ns.free_fun( 'f2' ) + type_info = f2.return_type + traits = declarations.find_container_traits( type_info ) + cls = traits .class_declaration( type_info ) + decl_string = cls.partial_decl_string #traits.remove_defaults(type_info) + key_type_string = traits.key_type(type_info).partial_decl_string + self.assert_(decl_string.startswith('::std::'), "declaration string %r doesn't start with 'std::'" % decl_string) + self.assert_(key_type_string.startswith('::std::'), "key type string %r doesn't start with 'std::'" % key_type_string) + def test_from_ogre( self ): x = 'map<std::string, bool (*)(std::string&, Ogre::MaterialScriptContext&), std::less<std::string>, std::allocator<std::pair<std::string const, bool (*)(std::string&, Ogre::MaterialScriptContext&)> > >' ct = declarations.find_container_traits( x ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2008-10-05 10:08:27
|
Revision: 1419 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1419&view=rev Author: roman_yakovenko Date: 2008-10-05 10:05:46 +0000 (Sun, 05 Oct 2008) Log Message: ----------- fix testers Modified Paths: -------------- pygccxml_dev/unittests/data/type_traits.hpp pygccxml_dev/unittests/find_container_traits_tester.py pygccxml_dev/unittests/type_traits_tester.py Modified: pygccxml_dev/unittests/data/type_traits.hpp =================================================================== --- pygccxml_dev/unittests/data/type_traits.hpp 2008-10-05 09:45:58 UTC (rev 1418) +++ pygccxml_dev/unittests/data/type_traits.hpp 2008-10-05 10:05:46 UTC (rev 1419) @@ -187,6 +187,10 @@ typedef detail::dd_t dd_t; typedef detail::f_t f_t; typedef detail::g_t g_t; + + typedef detail::const_container const_container_t; + typedef detail::const_item const_item_t; + } namespace no{ typedef std::string string_type; @@ -194,10 +198,7 @@ typedef std::vector< int > vector_of_int_type; typedef std::set< std::string > string_set_type; typedef std::multimap< std::string, std::string > s2s_multimap_type; - typedef detail::vertex vertex_type; - typedef detail::const_container const_container_t; - typedef detail::const_item const_item_t; - + typedef detail::vertex vertex_type; } } @@ -544,11 +545,13 @@ struct x{ x(){} }; +} + +namespace no{ + typedef details::const_item const_item; typedef details::const_container const_container; -} -namespace no{ class y{ private: y(){} Modified: pygccxml_dev/unittests/find_container_traits_tester.py =================================================================== --- pygccxml_dev/unittests/find_container_traits_tester.py 2008-10-05 09:45:58 UTC (rev 1418) +++ pygccxml_dev/unittests/find_container_traits_tester.py 2008-10-05 10:05:46 UTC (rev 1419) @@ -67,7 +67,7 @@ def test_multimap( self ): m = self.global_ns.class_( lambda decl: decl.name.startswith( 'multimap' ) ) traits = declarations.find_container_traits( m ) - self.failUness( m.partial_name == 'multimap< int, int >' ) + self.failUnless( m.partial_name == 'multimap< int, int >' ) def test_recursive_partial_name( self ): f1 = self.global_ns.free_fun( 'f1' ) Modified: pygccxml_dev/unittests/type_traits_tester.py =================================================================== --- pygccxml_dev/unittests/type_traits_tester.py 2008-10-05 09:45:58 UTC (rev 1418) +++ pygccxml_dev/unittests/type_traits_tester.py 2008-10-05 10:05:46 UTC (rev 1419) @@ -247,8 +247,8 @@ code = "struct const_item{ const int values[10]; };" global_ns = parser.parse_string( code , config )[0] ci = global_ns.class_( 'const_item' ) - self.failUnless( len( ci.declarations ) == 5 ) - #constructor, copy constructor, destructor, operator=, variable + self.failUnless( len( ci.declarations ) == 3 ) + #copy constructor, destructor, variable def create_suite(): suite = unittest.TestSuite() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2008-11-01 08:09:27
|
Revision: 1448 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1448&view=rev Author: roman_yakovenko Date: 2008-11-01 08:09:25 +0000 (Sat, 01 Nov 2008) Log Message: ----------- adding new tester Modified Paths: -------------- pygccxml_dev/unittests/test_all.py Added Paths: ----------- pygccxml_dev/unittests/data/classes.hpp pygccxml_dev/unittests/declaration_matcher_tester.py Added: pygccxml_dev/unittests/data/classes.hpp =================================================================== --- pygccxml_dev/unittests/data/classes.hpp (rev 0) +++ pygccxml_dev/unittests/data/classes.hpp 2008-11-01 08:09:25 UTC (rev 1448) @@ -0,0 +1,17 @@ +// 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 __classes_hpp__ +#define __classes_hpp__ + +struct cls{}; + +namespace ns{ + + struct nested_cls{}; + +} + +#endif//__classes_hpp__ Added: pygccxml_dev/unittests/declaration_matcher_tester.py =================================================================== --- pygccxml_dev/unittests/declaration_matcher_tester.py (rev 0) +++ pygccxml_dev/unittests/declaration_matcher_tester.py 2008-11-01 08:09:25 UTC (rev 1448) @@ -0,0 +1,56 @@ +# 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 unittest +import autoconfig +import parser_test_case + +from pygccxml import utils +from pygccxml import parser +from pygccxml import declarations + +class tester_t( parser_test_case.parser_test_case_t ): + global_ns = None + COMPILATION_MODE = parser.COMPILATION_MODE.ALL_AT_ONCE + def __init__(self, *args ): + parser_test_case.parser_test_case_t.__init__( self, *args ) + self.header = 'classes.hpp' + self.global_ns = None + + def setUp(self): + if not tester_t.global_ns: + decls = parser.parse( [self.header], self.config ) + tester_t.global_ns = declarations.get_global_namespace( decls ) + tester_t.global_ns.init_optimizer() + self.global_ns = tester_t.global_ns + + def test_global( self ): + gns = self.global_ns + gns.class_( 'cls' ) + gns.class_( '::cls' ) + + def test_ns1( self ): + gns = self.global_ns + ns1 = gns.namespace( 'ns' ) + + gns.class_( 'nested_cls' ) + self.failUnlessRaises( Exception, lambda: gns.class_( 'ns::nested_cls' ) ) + gns.class_( '::ns::nested_cls' ) + + self.failUnlessRaises( Exception, lambda: ns1.class_( '::nested_cls' ) ) + ns1.class_( 'nested_cls' ) + ns1.class_( '::ns::nested_cls' ) + +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: pygccxml_dev/unittests/test_all.py =================================================================== --- pygccxml_dev/unittests/test_all.py 2008-10-26 13:00:57 UTC (rev 1447) +++ pygccxml_dev/unittests/test_all.py 2008-11-01 08:09:25 UTC (rev 1448) @@ -51,6 +51,7 @@ import plain_c_tester import function_traits_tester import better_templates_matcher_tester +import declaration_matcher_tester testers = [ decl_string_tester @@ -98,6 +99,7 @@ , plain_c_tester , function_traits_tester , better_templates_matcher_tester + , declaration_matcher_tester ] def create_suite(): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2008-12-23 20:43:03
|
Revision: 1488 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1488&view=rev Author: roman_yakovenko Date: 2008-12-23 20:43:00 +0000 (Tue, 23 Dec 2008) Log Message: ----------- porting tester to MSVC 9.0 Modified Paths: -------------- pygccxml_dev/unittests/data/remove_template_defaults.hpp pygccxml_dev/unittests/remove_template_defaults_tester.py Modified: pygccxml_dev/unittests/data/remove_template_defaults.hpp =================================================================== --- pygccxml_dev/unittests/data/remove_template_defaults.hpp 2008-12-23 13:27:29 UTC (rev 1487) +++ pygccxml_dev/unittests/data/remove_template_defaults.hpp 2008-12-23 20:43:00 UTC (rev 1488) @@ -13,7 +13,7 @@ #else #include <hash_set> #include <hash_map> - #ifdef __GCCXML__ + #if defined( __GCCXML__ ) && !defined( __PYGCCXML_MSVC9__ ) #define HASH_XXX_NS std #else #define HASH_XXX_NS stdext @@ -31,22 +31,22 @@ template <class T> struct type {}; - -namespace vectors{ + +namespace vectors{ typedef std::vector< int > v_int; typedef std::vector< std::string > v_string; typedef std::vector< v_int > v_v_int; -} +} namespace lists{ typedef std::list< int > l_int; typedef std::list< std::wstring > l_wstring; } -namespace deques{ +namespace deques{ typedef std::deque< std::vector< int > > d_v_int; typedef std::deque< std::list< std::string > > d_l_string; -} +} namespace queues{ typedef std::queue< int > q_int; @@ -76,7 +76,7 @@ typedef std::map< int, double > m_i2d; typedef std::map< std::wstring, double > m_wstr2d; typedef std::map< const std::vector< int >, m_wstr2d > m_v_i2m_wstr2d; - + inline std::map<std::string, int> f2(){} } @@ -93,7 +93,7 @@ } -namespace hash_multisets{ +namespace hash_multisets{ typedef HASH_XXX_NS::hash_multiset< std::vector< int > > mhs_v_int; typedef HASH_XXX_NS::hash_multiset< std::string > mhs_string; } Modified: pygccxml_dev/unittests/remove_template_defaults_tester.py =================================================================== --- pygccxml_dev/unittests/remove_template_defaults_tester.py 2008-12-23 13:27:29 UTC (rev 1487) +++ pygccxml_dev/unittests/remove_template_defaults_tester.py 2008-12-23 20:43:00 UTC (rev 1488) @@ -16,138 +16,139 @@ def __init__(self, *args ): parser_test_case.parser_test_case_t.__init__( self, *args ) self.header = 'remove_template_defaults.hpp' - + def setUp(self): if not tester_t.global_ns: decls = parser.parse( [self.header], self.config ) tester_t.global_ns = declarations.get_global_namespace( decls ) tester_t.global_ns.init_optimizer() - def test_vector( self ): - v_int = self.global_ns.typedef( 'v_int' ) - self.failUnless( 'vector< int >' + def test_vector( self ): + v_int = self.global_ns.typedef( 'v_int' ) + self.failUnless( 'vector< int >' == declarations.vector_traits.remove_defaults( v_int ) ) v_string = self.global_ns.typedef( 'v_string' ) self.failUnless( 'vector< std::string >' == declarations.vector_traits.remove_defaults( v_string ) ) - v_v_int = self.global_ns.typedef( 'v_v_int' ) + v_v_int = self.global_ns.typedef( 'v_v_int' ) self.failUnless( 'vector< std::vector< int > >' == declarations.vector_traits.remove_defaults( v_v_int ) ) - - def test_list( self ): + + def test_list( self ): l_int = self.global_ns.typedef( 'l_int' ) - self.failUnless( 'list< int >' + self.failUnless( 'list< int >' == declarations.list_traits.remove_defaults( l_int ) ) l_wstring = self.global_ns.typedef( 'l_wstring' ) self.failUnless( 'list< std::wstring >' == declarations.list_traits.remove_defaults( l_wstring ) ) - def test_deque( self ): + def test_deque( self ): d_v_int = self.global_ns.typedef( 'd_v_int' ) - self.failUnless( 'deque< std::vector< int > >' + self.failUnless( 'deque< std::vector< int > >' == declarations.deque_traits.remove_defaults( d_v_int ) ) d_l_string = self.global_ns.typedef( 'd_l_string' ) self.failUnless( 'deque< std::list< std::string > >' == declarations.deque_traits.remove_defaults( d_l_string ) ) - def test_queue( self ): + def test_queue( self ): q_int = self.global_ns.typedef( 'q_int' ) - self.failUnless( 'queue< int >' + self.failUnless( 'queue< int >' == declarations.queue_traits.remove_defaults( q_int ) ) q_string = self.global_ns.typedef( 'q_string' ) self.failUnless( 'queue< std::string >' == declarations.queue_traits.remove_defaults( q_string ) ) - def test_priority_queue( self ): + def test_priority_queue( self ): pq_int = self.global_ns.typedef( 'pq_int' ) - self.failUnless( 'priority_queue< int >' + self.failUnless( 'priority_queue< int >' == declarations.priority_queue_traits.remove_defaults( pq_int ) ) pq_string = self.global_ns.typedef( 'pq_string' ) self.failUnless( 'priority_queue< std::string >' == declarations.priority_queue_traits.remove_defaults( pq_string ) ) - def test_set( self ): + def test_set( self ): s_v_int = self.global_ns.typedef( 's_v_int' ) - self.failUnless( 'set< std::vector< int > >' + self.failUnless( 'set< std::vector< int > >' == declarations.set_traits.remove_defaults( s_v_int ) ) s_string = self.global_ns.typedef( 's_string' ) self.failUnless( 'set< std::string >' == declarations.set_traits.remove_defaults( s_string ) ) - def test_multiset( self ): + def test_multiset( self ): ms_v_int = self.global_ns.typedef( 'ms_v_int' ) - self.failUnless( 'multiset< std::vector< int > >' + self.failUnless( 'multiset< std::vector< int > >' == declarations.multiset_traits.remove_defaults( ms_v_int ) ) ms_string = self.global_ns.typedef( 'ms_string' ) self.failUnless( 'multiset< std::string >' == declarations.multiset_traits.remove_defaults( ms_string ) ) - def test_map( self ): + def test_map( self ): m_i2d = self.global_ns.typedef( 'm_i2d' ) - self.failUnless( 'map< int, double >' + self.failUnless( 'map< int, double >' == declarations.map_traits.remove_defaults( m_i2d ) ) m_wstr2d = self.global_ns.typedef( 'm_wstr2d' ) - self.failUnless( 'map< std::wstring, double >' + self.failUnless( 'map< std::wstring, double >' == declarations.map_traits.remove_defaults( m_wstr2d ) ) - m_v_i2m_wstr2d = self.global_ns.typedef( 'm_v_i2m_wstr2d' ) - self.failUnless( 'map< const std::vector< int >, std::map< std::wstring, double > >' + m_v_i2m_wstr2d = self.global_ns.typedef( 'm_v_i2m_wstr2d' ) + self.failUnless( 'map< const std::vector< int >, std::map< std::wstring, double > >' == declarations.map_traits.remove_defaults( m_v_i2m_wstr2d ) ) - def test_multimap( self ): + def test_multimap( self ): mm_i2d = self.global_ns.typedef( 'mm_i2d' ) - self.failUnless( 'multimap< int, double >' + self.failUnless( 'multimap< int, double >' == declarations.multimap_traits.remove_defaults( mm_i2d ) ) mm_wstr2d = self.global_ns.typedef( 'mm_wstr2d' ) - self.failUnless( 'multimap< const std::wstring, double >' + self.failUnless( 'multimap< const std::wstring, double >' == declarations.multimap_traits.remove_defaults( mm_wstr2d ) ) - mm_v_i2mm_wstr2d = self.global_ns.typedef( 'mm_v_i2mm_wstr2d' ) - self.failUnless( 'multimap< const std::vector< int >, const std::multimap< const std::wstring, double > >' + mm_v_i2mm_wstr2d = self.global_ns.typedef( 'mm_v_i2mm_wstr2d' ) + self.failUnless( 'multimap< const std::vector< int >, const std::multimap< const std::wstring, double > >' == declarations.multimap_traits.remove_defaults( mm_v_i2mm_wstr2d ) ) - def test_hash_set( self ): + def test_hash_set( self ): hs_v_int = self.global_ns.typedef( 'hs_v_int' ) - self.failUnless( 'hash_set< std::vector< int > >' + self.failUnless( 'hash_set< std::vector< int > >' == declarations.hash_set_traits.remove_defaults( hs_v_int ) , declarations.hash_set_traits.remove_defaults( hs_v_int ) ) hs_string = self.global_ns.typedef( 'hs_string' ) self.failUnless( 'hash_set< std::string >' == declarations.hash_set_traits.remove_defaults( hs_string ) ) - def test_hash_multiset( self ): + def test_hash_multiset( self ): mhs_v_int = self.global_ns.typedef( 'mhs_v_int' ) - self.failUnless( 'hash_multiset< std::vector< int > >' + self.failUnless( 'hash_multiset< std::vector< int > >' == declarations.hash_multiset_traits.remove_defaults( mhs_v_int ) ) mhs_string = self.global_ns.typedef( 'mhs_string' ) self.failUnless( 'hash_multiset< std::string >' == declarations.hash_multiset_traits.remove_defaults( mhs_string ) ) - def test_hash_map( self ): + def test_hash_map( self ): hm_i2d = self.global_ns.typedef( 'hm_i2d' ) - self.failUnless( 'hash_map< int, double >' + self.failUnless( 'hash_map< int, double >' == declarations.hash_map_traits.remove_defaults( hm_i2d ) ) hm_wstr2d = self.global_ns.typedef( 'hm_wstr2d' ) - self.failUnless( 'hash_map< std::wstring, double >' + self.failUnless( 'hash_map< std::wstring, double >' == declarations.hash_map_traits.remove_defaults( hm_wstr2d ) ) - def test_hash_multimap( self ): + def test_hash_multimap( self ): hmm_i2d = self.global_ns.typedef( 'hmm_i2d' ) - self.failUnless( 'hash_multimap< int, double >' + self.failUnless( 'hash_multimap< int, double >' == declarations.hash_multimap_traits.remove_defaults( hmm_i2d ) ) hmm_wstr2d = self.global_ns.typedef( 'hmm_wstr2d' ) - self.failUnless( 'hash_multimap< const std::wstring, double >' + self.failUnless( 'hash_multimap< const std::wstring, double >' == declarations.hash_multimap_traits.remove_defaults( hmm_wstr2d ) ) - hmm_v_i2mm_wstr2d = self.global_ns.typedef( 'hmm_v_i2mm_wstr2d' ) - - possible_values = ( + hmm_v_i2mm_wstr2d = self.global_ns.typedef( 'hmm_v_i2mm_wstr2d' ) + + possible_values = ( 'hash_multimap< const std::vector< int >, const __gnu_cxx::hash_multimap< const std::wstring, double > >' - , 'hash_multimap< const std::vector< int >, const std::hash_multimap< const std::wstring, double > >' ) - - self.failUnless( declarations.hash_multimap_traits.remove_defaults( hmm_v_i2mm_wstr2d ) + , 'hash_multimap< const std::vector< int >, const std::hash_multimap< const std::wstring, double > >' + , 'hash_multimap< const std::vector< int >, const stdext::hash_multimap< const std::wstring, double > >' ) + + self.failUnless( declarations.hash_multimap_traits.remove_defaults( hmm_v_i2mm_wstr2d ) in possible_values ) def create_suite(): - suite = unittest.TestSuite() + suite = unittest.TestSuite() suite.addTest( unittest.makeSuite(tester_t)) return suite This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2009-01-07 11:01:02
|
Revision: 1545 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1545&view=rev Author: roman_yakovenko Date: 2009-01-07 11:00:58 +0000 (Wed, 07 Jan 2009) Log Message: ----------- making tester to be cross platform Modified Paths: -------------- pygccxml_dev/unittests/autoconfig.py pygccxml_dev/unittests/undname_creator_tester.py Property Changed: ---------------- pygccxml_dev/unittests/data/binary_parsers/ Modified: pygccxml_dev/unittests/autoconfig.py =================================================================== --- pygccxml_dev/unittests/autoconfig.py 2009-01-07 09:57:28 UTC (rev 1544) +++ pygccxml_dev/unittests/autoconfig.py 2009-01-07 11:00:58 UTC (rev 1545) @@ -28,6 +28,7 @@ print 'unittests will run on DEVELOPMENT version' compiler = pygccxml.utils.native_compiler.get_gccxml_compiler() +compiler = "msvc71" print 'GCCXML configured to simulate compiler ', compiler pygccxml.declarations.class_t.USE_DEMANGLED_AS_NAME = True Property changes on: pygccxml_dev/unittests/data/binary_parsers ___________________________________________________________________ Modified: svn:ignore - Release Debug *.suo + Release Debug *.suo binaries Modified: pygccxml_dev/unittests/undname_creator_tester.py =================================================================== --- pygccxml_dev/unittests/undname_creator_tester.py 2009-01-07 09:57:28 UTC (rev 1544) +++ pygccxml_dev/unittests/undname_creator_tester.py 2009-01-07 11:00:58 UTC (rev 1545) @@ -9,7 +9,7 @@ import autoconfig import parser_test_case -import pprint +import subprocess from pygccxml import binary_parsers from pygccxml import utils from pygccxml import parser @@ -33,17 +33,34 @@ def __init__(self, *args ): parser_test_case.parser_test_case_t.__init__( self, *args ) - self.header = r'msvc\mydll.h' + self.binary_parsers_dir = os.path.join( autoconfig.data_directory, 'binary_parsers' ) + self.header = os.path.join( self.binary_parsers_dir, r'mydll.h' ) + self.map_file = os.path.join( self.binary_parsers_dir, 'binaries', 'mydll.map' ) + self.dll_file = os.path.join( self.binary_parsers_dir, 'binaries', 'mydll.dll' ) - self.map_file = os.path.join( autoconfig.data_directory, 'msvc', 'release', 'mydll.map' ) - self.dll_file = os.path.join( autoconfig.data_directory, 'msvc', 'release', 'mydll.dll' ) - def setUp(self): if not tester_t.global_ns: decls = parser.parse( [self.header], self.config ) tester_t.global_ns = declarations.get_global_namespace( decls ) tester_t.global_ns.init_optimizer() + + process = subprocess.Popen( args='scons msvc_compiler=%s' % autoconfig.compiler + , shell=True + , stdin=subprocess.PIPE + , stdout=subprocess.PIPE + , stderr=subprocess.STDOUT + , cwd=self.binary_parsers_dir ) + process.stdin.close() + + while process.poll() is None: + line = process.stdout.readline() + print line.rstrip() + for line in process.stdout.readlines(): + print line.rstrip() + if process.returncode: + raise RuntimeError( "unable to compile binary parser module. See output for the errors." ) + def is_included( self, decl ): if not isinstance( decl, ( declarations.calldef_t, declarations.variable_t) ): return False This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2010-01-26 19:40:24
|
Revision: 1816 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1816&view=rev Author: roman_yakovenko Date: 2010-01-26 19:40:18 +0000 (Tue, 26 Jan 2010) Log Message: ----------- add tester for gccxml 10185 issue Modified Paths: -------------- pygccxml_dev/unittests/test_all.py pygccxml_dev/unittests/type_as_exception_bug_tester.py Added Paths: ----------- pygccxml_dev/unittests/gccxml10185_tester.py Added: pygccxml_dev/unittests/gccxml10185_tester.py =================================================================== --- pygccxml_dev/unittests/gccxml10185_tester.py (rev 0) +++ pygccxml_dev/unittests/gccxml10185_tester.py 2010-01-26 19:40:18 UTC (rev 1816) @@ -0,0 +1,42 @@ +# 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 unittest +import autoconfig +import parser_test_case + +from pygccxml import utils +from pygccxml import parser +from pygccxml import declarations + +code = \ +""" +template <typename T> struct A {}; +template <int N> struct A<const char[N]> +{ static int size(const char[N]) { return N - 1; } }; +""" + +class tester_t( parser_test_case.parser_test_case_t ): + def __init__(self, *args): + parser_test_case.parser_test_case_t.__init__(self, *args) + + def test(self): + src_reader = parser.source_reader_t( self.config ) + global_ns = declarations.get_global_namespace( src_reader.read_string( code ) ) + a = global_ns.class_( 'A<const char [N]>' ) + size = a.mem_fun( 'size' ) + + +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: pygccxml_dev/unittests/test_all.py =================================================================== --- pygccxml_dev/unittests/test_all.py 2010-01-26 19:36:54 UTC (rev 1815) +++ pygccxml_dev/unittests/test_all.py 2010-01-26 19:40:18 UTC (rev 1816) @@ -55,6 +55,7 @@ import calling_convention_tester import const_volatile_arg_tester import array_bug_tester +import gccxml10185_tester testers = [ decl_string_tester @@ -106,6 +107,7 @@ , calling_convention_tester , const_volatile_arg_tester , array_bug_tester + , gccxml10185_tester ] def create_suite(): Modified: pygccxml_dev/unittests/type_as_exception_bug_tester.py =================================================================== --- pygccxml_dev/unittests/type_as_exception_bug_tester.py 2010-01-26 19:36:54 UTC (rev 1815) +++ pygccxml_dev/unittests/type_as_exception_bug_tester.py 2010-01-26 19:40:18 UTC (rev 1816) @@ -24,14 +24,13 @@ tester_t.global_ns.init_optimizer() def test( self ): - pass - #~ buggy = self.global_ns.mem_fun( 'buggy' ) - #~ ExpressionError = self.global_ns.class_( 'ExpressionError' ) - #~ self.failUnless( len( buggy.exceptions ) == 1 ) - #~ err = buggy.exceptions[0] - #~ self.failUnless( declarations.is_reference( err ) ) - #~ err = declarations.remove_declarated( declarations.remove_reference( err ) ) - #~ self.failUnless( err is ExpressionError ) + buggy = self.global_ns.mem_fun( 'buggy' ) + ExpressionError = self.global_ns.class_( 'ExpressionError' ) + self.failUnless( len( buggy.exceptions ) == 1 ) + err = buggy.exceptions[0] + self.failUnless( declarations.is_reference( err ) ) + err = declarations.remove_declarated( declarations.remove_reference( err ) ) + self.failUnless( err is ExpressionError ) def create_suite(): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2010-01-26 20:14:12
|
Revision: 1818 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1818&view=rev Author: roman_yakovenko Date: 2010-01-26 20:14:05 +0000 (Tue, 26 Jan 2010) Log Message: ----------- adding new test case and fixing scons warning Modified Paths: -------------- pygccxml_dev/unittests/data/binary_parsers/sconstruct pygccxml_dev/unittests/declarations_tester.py pygccxml_dev/unittests/test_all.py Added Paths: ----------- pygccxml_dev/unittests/gccxml10183_tester.py Modified: pygccxml_dev/unittests/data/binary_parsers/sconstruct =================================================================== --- pygccxml_dev/unittests/data/binary_parsers/sconstruct 2010-01-26 19:43:03 UTC (rev 1817) +++ pygccxml_dev/unittests/data/binary_parsers/sconstruct 2010-01-26 20:14:05 UTC (rev 1818) @@ -1,16 +1,15 @@ import os import sys -opts = Options("options", ARGUMENTS) +vars = Variables() - if 'win32' in sys.platform: - opts.Add( EnumOption( 'msvc_compiler' - , 'prefered msvc compiler' - , 'msvc71' - , ['msvc71', 'msvc80', 'msvc90'] ) ) + vars.Add( EnumVariable( 'msvc_compiler' + , 'prefered msvc compiler' + , 'msvc71' + , ['msvc71', 'msvc80', 'msvc90'] ) ) -env = Environment(options = opts) +env = Environment(variables=vars) if 'win32' in sys.platform: Help(opts.GenerateHelpText(env)) Modified: pygccxml_dev/unittests/declarations_tester.py =================================================================== --- pygccxml_dev/unittests/declarations_tester.py 2010-01-26 19:43:03 UTC (rev 1817) +++ pygccxml_dev/unittests/declarations_tester.py 2010-01-26 20:14:05 UTC (rev 1818) @@ -165,8 +165,6 @@ def test_ellipsis( self ): ns = self.global_ns.ns( 'ellipsis_tester' ) do_smth = ns.mem_fun( 'do_smth' ) - for a in do_smth.arguments: - print str(a) self.failUnless( do_smth.has_ellipsis ) do_smth_else = ns.free_fun( 'do_smth_else' ) self.failUnless( do_smth_else.has_ellipsis ) Added: pygccxml_dev/unittests/gccxml10183_tester.py =================================================================== --- pygccxml_dev/unittests/gccxml10183_tester.py (rev 0) +++ pygccxml_dev/unittests/gccxml10183_tester.py 2010-01-26 20:14:05 UTC (rev 1818) @@ -0,0 +1,43 @@ +# 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 unittest +import autoconfig +import parser_test_case + +from pygccxml import utils +from pygccxml import parser +from pygccxml import declarations + +code = \ +""" +template <typename> class A {}; +template <typename T> void f(A<T> const& a){ A<__typeof__(a)>(); } +template void f<int>(A<int> const& a); +""" + +class tester_t( parser_test_case.parser_test_case_t ): + def __init__(self, *args): + parser_test_case.parser_test_case_t.__init__(self, *args) + + def test(self): + src_reader = parser.source_reader_t( self.config ) + global_ns = declarations.get_global_namespace( src_reader.read_string( code ) ) + a = global_ns.decl( 'A<int>' ) + f = global_ns.free_fun( 'f' ) + self.failUnless( f.demangled == 'void f<int>(A<int> const&)' ) + + +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: pygccxml_dev/unittests/test_all.py =================================================================== --- pygccxml_dev/unittests/test_all.py 2010-01-26 19:43:03 UTC (rev 1817) +++ pygccxml_dev/unittests/test_all.py 2010-01-26 20:14:05 UTC (rev 1818) @@ -56,6 +56,7 @@ import const_volatile_arg_tester import array_bug_tester import gccxml10185_tester +import gccxml10183_tester testers = [ decl_string_tester @@ -108,6 +109,7 @@ , const_volatile_arg_tester , array_bug_tester , gccxml10185_tester + , gccxml10183_tester ] def create_suite(): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2010-01-31 08:02:23
|
Revision: 1823 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1823&view=rev Author: roman_yakovenko Date: 2010-01-31 08:02:15 +0000 (Sun, 31 Jan 2010) Log Message: ----------- porting tests to x86_64 architecture Modified Paths: -------------- pygccxml_dev/unittests/autoconfig.py pygccxml_dev/unittests/demangled_tester.py pygccxml_dev/unittests/patcher_tester.py Modified: pygccxml_dev/unittests/autoconfig.py =================================================================== --- pygccxml_dev/unittests/autoconfig.py 2010-01-31 08:00:00 UTC (rev 1822) +++ pygccxml_dev/unittests/autoconfig.py 2010-01-31 08:02:15 UTC (rev 1823) @@ -6,6 +6,7 @@ import os import sys import getpass +import platform #~ os.environ['PYCHECKER'] = '--limit=1000 -q --no-argsused' #~ import pychecker.checker @@ -15,7 +16,9 @@ data_directory = os.path.join( this_module_dir_path, 'data' ) build_directory = os.path.join( this_module_dir_path, 'temp' ) -gccxml_path = os.path.join( this_module_dir_path, '..', '..', 'gccxml_bin', 'v09', sys.platform, 'bin' ) +gccxml_path = os.path.join( this_module_dir_path, '..', '..', 'gccxml_bin', 'v09', platform.system(), platform.machine(), 'bin' ) +if not os.path.exists( gccxml_path ): + gccxml_path = os.path.join( this_module_dir_path, '..', '..', 'gccxml_bin', 'v09', sys.platform, 'bin' ) gccxml_version = '__GCCXML_09__' try: Modified: pygccxml_dev/unittests/demangled_tester.py =================================================================== --- pygccxml_dev/unittests/demangled_tester.py 2010-01-31 08:00:00 UTC (rev 1822) +++ pygccxml_dev/unittests/demangled_tester.py 2010-01-31 08:02:15 UTC (rev 1823) @@ -4,6 +4,7 @@ # http://www.boost.org/LICENSE_1_0.txt) import os +import platform import unittest import autoconfig import parser_test_case @@ -18,7 +19,7 @@ self.header = 'demangled.hpp' self.global_ns = None self.architecture = architecture - + def setUp(self): reader = parser.source_reader_t( self.config ) decls = None @@ -27,17 +28,22 @@ else: original_get_architecture = utils.get_architecture utils.get_architecture = lambda: 64 - decls = reader.read_xml_file( + decls = reader.read_xml_file( os.path.join( autoconfig.data_directory, 'demangled_tester_64bit.xml' ) ) utils.get_architecture = original_get_architecture self.global_ns = declarations.get_global_namespace( decls ) - - def test( self ): + + def test( self ): demangled = self.global_ns.namespace( 'demangled' ) if 32 == self.architecture: if '0.9' in demangled.compiler: - cls = demangled.class_( 'item_t<3740067437ul, 11ul, 2147483648ul>' ) - self.failUnless( cls._name == 'item_t<-554899859ul,11ul,-2147483648ul>' ) + if platform.machine() == 'x86_64': + cls = demangled.class_( 'item_t<25214903917ul, 11ul, 2147483648ul>' ) + self.failUnless( cls._name == 'item_t<25214903917ul,11ul,2147483648ul>' + , cls._name ) + else: + cls = demangled.class_( 'item_t<3740067437ul, 11ul, 2147483648ul>' ) + self.failUnless( cls._name == 'item_t<-554899859ul,11ul,-2147483648ul>') else: cls = demangled.class_( 'item_t<3740067437l, 11l, 2147483648l>' ) self.failUnless( cls._name == 'item_t<0x0deece66d,11,0x080000000>' ) @@ -48,7 +54,7 @@ def test_free_function( self ): f = self.global_ns.free_functions('set_a', allow_empty=True) if not f: - return + return f = f[0] self.failUnless( f.mangled ) @@ -60,11 +66,11 @@ def __init__(self, *args): tester_impl_t.__init__(self, 64, *args) - + def create_suite(): - suite = unittest.TestSuite() - suite.addTest( unittest.makeSuite(tester_32_t)) - suite.addTest( unittest.makeSuite(tester_64_t)) + suite = unittest.TestSuite() + suite.addTest( unittest.makeSuite(tester_32_t)) + suite.addTest( unittest.makeSuite(tester_64_t)) return suite def run_suite(): Modified: pygccxml_dev/unittests/patcher_tester.py =================================================================== --- pygccxml_dev/unittests/patcher_tester.py 2010-01-31 08:00:00 UTC (rev 1822) +++ pygccxml_dev/unittests/patcher_tester.py 2010-01-31 08:02:15 UTC (rev 1823) @@ -5,6 +5,7 @@ import os import unittest +import platform import autoconfig import parser_test_case @@ -17,7 +18,7 @@ parser_test_case.parser_test_case_t.__init__(self, *args) self.architecture = architecture self.global_ns = None - + def test_enum_patcher(self): fix_enum = self.global_ns.free_fun( 'fix_enum' ) self.failUnless( fix_enum.arguments[0].default_value == '::ns1::ns2::apple' ) @@ -28,12 +29,19 @@ fix_numeric = self.global_ns.free_fun( 'fix_numeric' ) if 32 == self.architecture: if '0.9' in fix_numeric.compiler: - self.failUnless( fix_numeric.arguments[0].default_value == u"0xffffffffffffffffu" ) + if platform.machine() == 'x86_64': + self.failUnless( fix_numeric.arguments[0].default_value == u"-1u" + , fix_numeric.arguments[0].default_value ) + else: + self.failUnless( fix_numeric.arguments[0].default_value == u"0xffffffffffffffffu" + , fix_numeric.arguments[0].default_value ) else: - self.failUnless( fix_numeric.arguments[0].default_value == u"0xffffffffffffffff" ) - else: - self.failUnless( fix_numeric.arguments[0].default_value == u"0ffffffff" ) - + self.failUnless( fix_numeric.arguments[0].default_value == u"0xffffffffffffffff" + , fix_numeric.arguments[0].default_value ) + else: + self.failUnless( fix_numeric.arguments[0].default_value == u"0ffffffff" + , fix_numeric.arguments[0].default_value ) + def test_unnamed_enum_patcher(self): fix_unnamed = self.global_ns.free_fun( 'fix_unnamed' ) self.failUnless( fix_unnamed.arguments[0].default_value == u"int(::fx::unnamed)" ) @@ -65,11 +73,11 @@ default_values = [ 'vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >()' , 'vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >((&allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >()))' - ] + ] self.failUnless( clone_tree.arguments[0].default_value in default_values) - + class tester_32_t( tester_impl_t ): - global_ns = None + global_ns = None def __init__(self, *args): tester_impl_t.__init__(self, 32, *args) @@ -77,7 +85,7 @@ if not tester_32_t.global_ns: reader = parser.source_reader_t( self.config ) tester_32_t.global_ns = reader.read_file( 'patcher.hpp' )[0].top_parent - self.global_ns = tester_32_t.global_ns + self.global_ns = tester_32_t.global_ns class tester_64_t( tester_impl_t ): @@ -92,17 +100,17 @@ if not tester_64_t.global_ns: reader = parser.source_reader_t( self.config ) - tester_64_t.global_ns = reader.read_xml_file( + tester_64_t.global_ns = reader.read_xml_file( os.path.join( autoconfig.data_directory, 'patcher_tester_64bit.xml' ) )[0].top_parent self.global_ns = tester_64_t.global_ns - + def tearDown( self ): utils.get_architecture = self.original_get_architecture def create_suite(): - suite = unittest.TestSuite() - suite.addTest( unittest.makeSuite(tester_32_t)) - suite.addTest( unittest.makeSuite(tester_64_t)) + suite = unittest.TestSuite() + suite.addTest( unittest.makeSuite(tester_32_t)) + suite.addTest( unittest.makeSuite(tester_64_t)) return suite def run_suite(): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |