[pygccxml-commit] SF.net SVN: pygccxml:[1498] pyplusplus_dev/unittests
Brought to you by:
mbaas,
roman_yakovenko
|
From: <rom...@us...> - 2008-12-24 22:22:10
|
Revision: 1498
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1498&view=rev
Author: roman_yakovenko
Date: 2008-12-24 21:48:48 +0000 (Wed, 24 Dec 2008)
Log Message:
-----------
adding initial test for ctypes builder
Modified Paths:
--------------
pyplusplus_dev/unittests/test_all.py
Added Paths:
-----------
pyplusplus_dev/unittests/ctypes_pof_tester.py
pyplusplus_dev/unittests/data/ctypes_pof/
pyplusplus_dev/unittests/data/ctypes_pof/mydll.cpp
pyplusplus_dev/unittests/data/ctypes_pof/mydll.h
pyplusplus_dev/unittests/data/ctypes_pof/mydll.vcproj
Added: pyplusplus_dev/unittests/ctypes_pof_tester.py
===================================================================
--- pyplusplus_dev/unittests/ctypes_pof_tester.py (rev 0)
+++ pyplusplus_dev/unittests/ctypes_pof_tester.py 2008-12-24 21:48:48 UTC (rev 1498)
@@ -0,0 +1,33 @@
+# 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 ctypes
+import unittest
+import autoconfig
+from pyplusplus.module_builder import ctypes_module_builder_t
+
+class tester_t(unittest.TestCase):
+ def __init__( self, *args, **keywd ):
+ unittest.TestCase.__init__( self, *args, **keywd )
+ self.project_dir = os.path.join( autoconfig.data_directory, 'ctypes_pof' )
+ self.header = os.path.join( self.project_dir, 'mydll.h' )
+ self.symbols_file = os.path.join( self.project_dir, 'release', 'mydll.dll' )
+
+ def test(self):
+ mb = ctypes_module_builder_t( [self.header], self.symbols_file, autoconfig.cxx_parsers_cfg.gccxml )
+
+def create_suite():
+ suite = unittest.TestSuite()
+ if 'win' in sys.platform:
+ 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/data/ctypes_pof/mydll.cpp
===================================================================
--- pyplusplus_dev/unittests/data/ctypes_pof/mydll.cpp (rev 0)
+++ pyplusplus_dev/unittests/data/ctypes_pof/mydll.cpp 2008-12-24 21:48:48 UTC (rev 1498)
@@ -0,0 +1,59 @@
+#include "mydll.h"
+#include "windows.h"
+#include <iostream>
+
+number_t::number_t()
+: m_value(0)
+{
+// std::cout << "{C++} number_t( 0 )" << std::endl;
+}
+
+
+number_t::number_t(int value)
+: m_value(value)
+{
+// std::cout << "{C++} number_t( " << value << " )" << std::endl;
+}
+
+number_t::~number_t() {
+// std::cout << "{C++} ~number_t()" << std::endl;
+}
+void number_t::print_it() const {
+ std::cout << "{C++} value: " << m_value << std::endl;
+}
+
+int number_t::get_value() const{
+ return m_value;
+}
+
+void number_t::set_value(int x){
+ m_value = x;
+}
+
+number_t number_t::clone() const{
+ return number_t(*this);
+}
+
+std::auto_ptr<number_t> number_t::clone_ptr() const{
+ return std::auto_ptr<number_t>( new number_t( *this ) );
+}
+
+void do_smth( number_aptr_t& ){
+}
+
+BOOL APIENTRY DllMain( HMODULE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved
+ )
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+
Added: pyplusplus_dev/unittests/data/ctypes_pof/mydll.h
===================================================================
--- pyplusplus_dev/unittests/data/ctypes_pof/mydll.h (rev 0)
+++ pyplusplus_dev/unittests/data/ctypes_pof/mydll.h 2008-12-24 21:48:48 UTC (rev 1498)
@@ -0,0 +1,25 @@
+#pragma once
+
+#include <memory>
+
+class __declspec(dllexport) number_t{
+public:
+ number_t();
+ explicit number_t(int value);
+ virtual ~number_t();
+ void print_it() const;
+ int get_value() const;
+ int get_value(){ return m_value; }
+ void set_value(int x);
+
+ number_t clone() const;
+ std::auto_ptr<number_t> clone_ptr() const;
+private:
+ int m_value;
+};
+
+template class __declspec(dllexport) std::auto_ptr< number_t >;
+
+typedef std::auto_ptr< number_t > number_aptr_t;
+
+void __declspec(dllexport) do_smth( number_aptr_t& );
\ No newline at end of file
Added: pyplusplus_dev/unittests/data/ctypes_pof/mydll.vcproj
===================================================================
--- pyplusplus_dev/unittests/data/ctypes_pof/mydll.vcproj (rev 0)
+++ pyplusplus_dev/unittests/data/ctypes_pof/mydll.vcproj 2008-12-24 21:48:48 UTC (rev 1498)
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="mydll"
+ ProjectGUID="{E7A34C45-534F-43A6-AF95-3CA2428619E2}"
+ RootNamespace="mydll"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MYDLL_EXPORTS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MYDLL_EXPORTS"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ BrowseInformation="1"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ GenerateMapFile="true"
+ MapExports="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\mydll.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\mydll.h"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Modified: pyplusplus_dev/unittests/test_all.py
===================================================================
--- pyplusplus_dev/unittests/test_all.py 2008-12-24 21:22:12 UTC (rev 1497)
+++ pyplusplus_dev/unittests/test_all.py 2008-12-24 21:48:48 UTC (rev 1498)
@@ -110,6 +110,7 @@
import cp_return_addressof_tester
import make_constructor_tester
import return_auto_ptr_tester
+import ctypes_pof_tester
#import ogre_generate_tester
testers = [
@@ -208,6 +209,7 @@
, make_constructor_tester
, return_auto_ptr_tester
, protected_bug_tester
+ , ctypes_pof_tester
# , ogre_generate_tester too much time
]
@@ -306,7 +308,11 @@
def __call__( self ):
start_time = time.time()
- [ m() for m in self.__m_runners ]
+ for index, tester in enumerate( self.__m_runners ):
+ print '\n\n{[<@>]}running tests complition: %d%%' % int( index * 100.0 // len(self.__m_runners) )
+ print '--------------------------------^^^^^\n\n'
+ ( index, len(self.__m_runners) )
+ tester()
self.__total_time = time.time() - start_time
self.__dump_statistics()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|