[pygccxml-commit] SF.net SVN: pygccxml: [1181] pyplusplus_dev/unittests
Brought to you by:
mbaas,
roman_yakovenko
|
From: <rom...@us...> - 2007-11-29 07:02:53
|
Revision: 1181
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1181&view=rev
Author: roman_yakovenko
Date: 2007-11-28 23:02:58 -0800 (Wed, 28 Nov 2007)
Log Message:
-----------
improving create_with_signature algorithm - fucntion, which are template instantiations will be exposed with signature
Modified Paths:
--------------
pyplusplus_dev/unittests/test_all.py
Added Paths:
-----------
pyplusplus_dev/unittests/data/mailing_list_help_to_be_exported.hpp
pyplusplus_dev/unittests/data/templates_to_be_exported.hpp
pyplusplus_dev/unittests/mailing_list_help_tester.py
pyplusplus_dev/unittests/templates_tester.py
Added: pyplusplus_dev/unittests/data/mailing_list_help_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/mailing_list_help_to_be_exported.hpp (rev 0)
+++ pyplusplus_dev/unittests/data/mailing_list_help_to_be_exported.hpp 2007-11-29 07:02:58 UTC (rev 1181)
@@ -0,0 +1,20 @@
+#ifndef __mailing_list_help_hpp__
+#define __mailing_list_help_hpp__
+
+#include <string>
+
+class foo
+{
+public:
+
+ foo() {std::strcpy(buffer, "good bye cruel world!\0\0");}
+ char buffer[24];
+};
+
+class bar
+{
+public:
+ foo f;
+};
+
+#endif//__mailing_list_help_hpp__
Added: pyplusplus_dev/unittests/data/templates_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/templates_to_be_exported.hpp (rev 0)
+++ pyplusplus_dev/unittests/data/templates_to_be_exported.hpp 2007-11-29 07:02:58 UTC (rev 1181)
@@ -0,0 +1,31 @@
+// 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 __enums_to_be_exported_hpp__
+#define __enums_to_be_exported_hpp__
+
+#include "boost/rational.hpp"
+
+class C{
+public:
+
+ template<typename T>
+ T get_value() const{
+ return static_cast<T>(m_value);
+ }
+
+private:
+ int m_value;
+};
+
+struct instantiator_t{
+ instantiator_t(){
+ boost::gcd<long int>( 1, 1);
+ C c;
+ c.get_value<int>();
+ }
+};
+
+#endif//__enums_to_be_exported_hpp__
Added: pyplusplus_dev/unittests/mailing_list_help_tester.py
===================================================================
--- pyplusplus_dev/unittests/mailing_list_help_tester.py (rev 0)
+++ pyplusplus_dev/unittests/mailing_list_help_tester.py 2007-11-29 07:02:58 UTC (rev 1181)
@@ -0,0 +1,47 @@
+# 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)
+
+import os
+import sys
+import unittest
+import fundamental_tester_base
+from pyplusplus import code_creators
+
+class tester_t(fundamental_tester_base.fundamental_tester_base_t):
+ EXTENSION_NAME = 'mailing_list_help'
+
+ def __init__( self, *args ):
+ fundamental_tester_base.fundamental_tester_base_t.__init__(
+ self
+ , tester_t.EXTENSION_NAME
+ , *args )
+
+ def customize(self, mb ):
+ foo = mb.class_( 'foo' )
+ foo.add_wrapper_code( 'static std::string get_buffer(const foo& x) { return std::string(x.buffer); }' )
+ foo.add_registration_code( 'def("__str__", &foo_wrapper::get_buffer)' )
+ #bar = mb.class_( 'bar' )
+ #bar.var( 'f' ).use_make_functions = True
+
+ def run_tests( self, module):
+ f1 = module.foo()
+ print 'f1.buffer: ', f1.buffer
+ print 'str(f1):', str(f1)
+ b1 = module.bar()
+ print 'b1.f.buffer:', b1.f.buffer
+ print 'b1.f:', b1.f
+ print 'str(b1.f):', str(b1.f)
+
+
+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()
Added: pyplusplus_dev/unittests/templates_tester.py
===================================================================
--- pyplusplus_dev/unittests/templates_tester.py (rev 0)
+++ pyplusplus_dev/unittests/templates_tester.py 2007-11-29 07:02:58 UTC (rev 1181)
@@ -0,0 +1,43 @@
+# 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)
+
+import os
+import sys
+import unittest
+import fundamental_tester_base
+
+class tester_t(fundamental_tester_base.fundamental_tester_base_t):
+ EXTENSION_NAME = 'templates'
+
+ def __init__( self, *args ):
+ fundamental_tester_base.fundamental_tester_base_t.__init__(
+ self
+ , tester_t.EXTENSION_NAME
+ , *args )
+
+ def customize(self, mb ):
+ mb.global_ns.exclude()
+ gcd = mb.free_fun( 'gcd' )
+ gcd.include()
+ c = mb.class_('C')
+ c.include()
+ for f in [gcd, c.mem_fun( 'get_value' )]:
+ f.alias = f.name
+ f.name = f.demangled_name
+ #f.create_with_signature = True
+
+ def run_tests(self, module):
+ pass
+
+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 2007-11-29 06:59:58 UTC (rev 1180)
+++ pyplusplus_dev/unittests/test_all.py 2007-11-29 07:02:58 UTC (rev 1181)
@@ -82,6 +82,7 @@
import custom_smart_ptr_classes_tester
import custom_string_tester
import final_classes_tester
+import templates_tester
#gui_tester
#gui_wizard_tester
#
@@ -178,6 +179,7 @@
, unicode_bug
, include_exclude_bug_tester
, vector_with_shared_data_tester
+ , templates_tester
]
class module_runner_t( object ):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|