[pygccxml-commit] SF.net SVN: pygccxml: [1231] pyplusplus_dev/unittests
Brought to you by:
mbaas,
roman_yakovenko
|
From: <rom...@us...> - 2008-02-04 06:36:49
|
Revision: 1231
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1231&view=rev
Author: roman_yakovenko
Date: 2008-02-03 22:36:54 -0800 (Sun, 03 Feb 2008)
Log Message:
-----------
adding new unit test
Modified Paths:
--------------
pyplusplus_dev/unittests/test_all.py
Added Paths:
-----------
pyplusplus_dev/unittests/data/ft_inout_bugs_to_be_exported.hpp
pyplusplus_dev/unittests/ft_inout_tester.py
Added: pyplusplus_dev/unittests/data/ft_inout_bugs_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/ft_inout_bugs_to_be_exported.hpp (rev 0)
+++ pyplusplus_dev/unittests/data/ft_inout_bugs_to_be_exported.hpp 2008-02-04 06:36:54 UTC (rev 1231)
@@ -0,0 +1,20 @@
+
+namespace tests{
+
+inline void set_flag( bool value, bool& flag ){
+ flag = value;
+}
+
+struct base{
+ virtual void set_flag( bool value, bool& flag ){
+ flag = value;
+ }
+};
+
+struct inventor : base{
+ virtual void set_flag( bool value, bool& flag ){
+ flag = !value;
+ }
+};
+
+}
Added: pyplusplus_dev/unittests/ft_inout_tester.py
===================================================================
--- pyplusplus_dev/unittests/ft_inout_tester.py (rev 0)
+++ pyplusplus_dev/unittests/ft_inout_tester.py 2008-02-04 06:36:54 UTC (rev 1231)
@@ -0,0 +1,52 @@
+# 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 math
+import unittest
+import fundamental_tester_base
+from pygccxml import declarations
+from pyplusplus import function_transformers as ft
+from pyplusplus.module_builder import call_policies
+
+
+class tester_t(fundamental_tester_base.fundamental_tester_base_t):
+ EXTENSION_NAME = 'ft_inout_bugs'
+
+ 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()
+ #~ mb.namespace( 'tests' ).include()
+ set_flag = mb.calldefs( 'set_flag' )
+ set_flag.add_transformation( ft.inout(1) )
+
+ def run_tests(self, module):
+ x = False
+ self.failUnless( True == module.set_flag( True, x ) )
+ self.failUnless( False == module.set_flag( False, x ) )
+ b = module.base()
+ self.failUnless( True == b.set_flag( True, x ) )
+ self.failUnless( False == b.set_flag( False, x ) )
+ inventor = module.inventor()
+ self.failUnless( False == inventor.set_flag( True, x ) )
+ self.failUnless( True == inventor.set_flag( False, x ) )
+
+
+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 2008-02-03 20:22:34 UTC (rev 1230)
+++ pyplusplus_dev/unittests/test_all.py 2008-02-04 06:36:54 UTC (rev 1231)
@@ -98,8 +98,8 @@
import constructors_bug_tester
import precompiled_header_tester
import balanced_files_tester
+import ft_inout_tester
-
testers = [
algorithms_tester
, module_body_tester
@@ -184,6 +184,7 @@
, constructors_bug_tester
, precompiled_header_tester
, balanced_files_tester
+ , ft_inout_tester
]
class module_runner_t( object ):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|