[pygccxml-commit] SF.net SVN: pygccxml: [1166] pyplusplus_dev/unittests
Brought to you by:
mbaas,
roman_yakovenko
|
From: <rom...@us...> - 2007-11-21 21:07:19
|
Revision: 1166
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1166&view=rev
Author: roman_yakovenko
Date: 2007-11-21 13:07:24 -0800 (Wed, 21 Nov 2007)
Log Message:
-----------
adding new unittest
Added Paths:
-----------
pyplusplus_dev/unittests/data/vector_with_shared_data_to_be_exported.cpp
pyplusplus_dev/unittests/data/vector_with_shared_data_to_be_exported.hpp
pyplusplus_dev/unittests/vector_with_shared_data_tester.py
Added: pyplusplus_dev/unittests/data/vector_with_shared_data_to_be_exported.cpp
===================================================================
--- pyplusplus_dev/unittests/data/vector_with_shared_data_to_be_exported.cpp (rev 0)
+++ pyplusplus_dev/unittests/data/vector_with_shared_data_to_be_exported.cpp 2007-11-21 21:07:24 UTC (rev 1166)
@@ -0,0 +1,12 @@
+#include "vector_with_shared_data_to_be_exported.hpp"
+
+namespace samples{
+
+std::vector< boost::shared_ptr<data> > do_smth(){
+ std::vector< boost::shared_ptr<data> > result;
+ result.push_back( boost::shared_ptr<data>( new data() ) );
+ result.push_back( boost::shared_ptr<data>( new data() ) );
+ return result;
+}
+
+}
Added: pyplusplus_dev/unittests/data/vector_with_shared_data_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/vector_with_shared_data_to_be_exported.hpp (rev 0)
+++ pyplusplus_dev/unittests/data/vector_with_shared_data_to_be_exported.hpp 2007-11-21 21:07:24 UTC (rev 1166)
@@ -0,0 +1,19 @@
+#ifndef __vector_with_shared_data_hpp__
+#define __vector_with_shared_data_hpp__
+
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+namespace samples{
+
+class data{};
+
+std::vector< boost::shared_ptr<data> > do_smth();
+
+}
+
+namespace pyplusplus{ namespace aliases{
+ typedef std::vector< boost::shared_ptr<samples::data> > shared_data_container_t;
+} }
+
+#endif//__vector_with_shared_data_hpp__
Added: pyplusplus_dev/unittests/vector_with_shared_data_tester.py
===================================================================
--- pyplusplus_dev/unittests/vector_with_shared_data_tester.py (rev 0)
+++ pyplusplus_dev/unittests/vector_with_shared_data_tester.py 2007-11-21 21:07:24 UTC (rev 1166)
@@ -0,0 +1,59 @@
+# 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 autoconfig
+from pyplusplus import utils
+import fundamental_tester_base
+from pygccxml import declarations
+from pyplusplus import module_builder
+from pyplusplus.module_builder import call_policies
+
+class tester_t(fundamental_tester_base.fundamental_tester_base_t):
+ EXTENSION_NAME = 'vector_with_shared_data'
+
+ def __init__( self, *args ):
+ fundamental_tester_base.fundamental_tester_base_t.__init__(
+ self
+ , tester_t.EXTENSION_NAME
+ , indexing_suite_version=2
+ , *args )
+ self.files = []
+
+ def customize( self, mb ):
+ mb.global_ns.exclude()
+ mb.namespace( 'samples' ).include()
+ do_smth = mb.free_fun( 'do_smth' )
+ v = declarations.remove_declarated( do_smth.return_type )
+ v.indexing_suite.disable_method( 'sort' )
+ v.indexing_suite.disable_method( 'count' )
+ v.indexing_suite.disable_method( 'index' )
+ v.indexing_suite.disable_method( 'contains' )
+
+ def generate_source_files( self, mb ):
+ files = mb.split_module( autoconfig.build_dir, on_unused_file_found=lambda fpath: fpath )
+ self.files = filter( lambda fname: fname.endswith( 'cpp' ), files )
+ self.files.append( os.path.join( autoconfig.data_directory
+ , self.EXTENSION_NAME + '_to_be_exported.cpp' ) )
+
+ def get_source_files( self ):
+ return self.files
+
+ def run_tests(self, module):
+ x = module.do_smth()
+ self.failUnless( len(x) == 2 )
+
+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()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|