[pygccxml-commit] SF.net SVN: pygccxml:[1600] pyplusplus_dev/unittests
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2009-01-20 07:40:36
|
Revision: 1600 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1600&view=rev Author: roman_yakovenko Date: 2009-01-20 07:40:31 +0000 (Tue, 20 Jan 2009) Log Message: ----------- adding new unit test that checks code generation for references Modified Paths: -------------- pyplusplus_dev/unittests/test_all.py Added Paths: ----------- pyplusplus_dev/unittests/data/refee_refer_to_be_exported.hpp pyplusplus_dev/unittests/refee_refer_tester.py Added: pyplusplus_dev/unittests/data/refee_refer_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/refee_refer_to_be_exported.hpp (rev 0) +++ pyplusplus_dev/unittests/data/refee_refer_to_be_exported.hpp 2009-01-20 07:40:31 UTC (rev 1600) @@ -0,0 +1,24 @@ +// 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 __refee_refer_to_be_exported_hpp__ +#define __refee_refer_to_be_exported_hpp__ + +#include <memory> + +struct refee_t{ + int i; +}; + +struct refer_t{ + refee_t& refee; +}; + +inline std::auto_ptr<refer_t> make_refer(refee_t* refee){ + refer_t tmp = { *refee }; + return std::auto_ptr<refer_t>(new refer_t(tmp)); +} + +#endif//__refee_refer_to_be_exported_hpp__ Added: pyplusplus_dev/unittests/refee_refer_tester.py =================================================================== --- pyplusplus_dev/unittests/refee_refer_tester.py (rev 0) +++ pyplusplus_dev/unittests/refee_refer_tester.py 2009-01-20 07:40:31 UTC (rev 1600) @@ -0,0 +1,37 @@ +# 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 + +class tester_t(fundamental_tester_base.fundamental_tester_base_t): + EXTENSION_NAME = 'refee_refer' + + def __init__( self, *args ): + fundamental_tester_base.fundamental_tester_base_t.__init__( + self + , tester_t.EXTENSION_NAME + , *args ) + + def run_tests(self, module): + refee = module.refee_t(); + refee.i = 19888 + + refer = module.make_refer( refee ) + self.failUnless( refer.get_refee().i == 19888 ) + +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-01-20 06:16:27 UTC (rev 1599) +++ pyplusplus_dev/unittests/test_all.py 2009-01-20 07:40:31 UTC (rev 1600) @@ -112,6 +112,7 @@ import make_constructor_tester import return_auto_ptr_tester import ctypes_pof_tester +import refee_refer_tester #import ogre_generate_tester testers = [ @@ -211,6 +212,7 @@ , return_auto_ptr_tester , protected_bug_tester , ctypes_pof_tester + , refee_refer_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. |