[Cppunit-cvs] cppunit/examples/qt make_example,NONE,1.1 make_example.bat,NONE,1.1 qt_example.sln,NON
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2006-02-01 21:11:07
|
Update of /cvsroot/cppunit/cppunit/examples/qt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27068/examples/qt Modified Files: ExampleTestCases.cpp ExampleTestCases.h Main.cpp qt_example.pro Added Files: make_example make_example.bat qt_example.sln qt_example.vcproj qt_example_dll.vcproj Removed Files: build.bat Log Message: examples/qt: integrated Ernst patch from qt examples. --- NEW FILE: make_example --- #!/bin/tcsh ########################################################################### # FILE: make_example # PURPOSE: Create Makefile from project file and then make QtTestRunner # example. ########################################################################### qmake qt_example.pro make distclean make Index: Main.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit/examples/qt/Main.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Main.cpp 13 Mar 2004 10:52:27 -0000 1.3 --- Main.cpp 1 Feb 2006 21:10:59 -0000 1.4 *************** *** 8,12 **** QApplication app( argc, argv ); ! CPPUNIT_NS::QtUi::TestRunner runner; runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() ); runner.run( true ); --- 8,15 ---- QApplication app( argc, argv ); ! //CPPUNIT_NS::QtUi::TestRunner runner; ! ! CPPUNIT_NS::QtTestRunner runner; ! runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() ); runner.run( true ); --- NEW FILE: qt_example.sln --- Microsoft Visual Studio Solution File, Format Version 8.00 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qt_example", "qt_example.vcproj", "{84D9CB1F-5FD9-4794-BF6F-58DB10CCB8FD}" ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SampleUnitTest_with_DLL", "qt_example_dll.vcproj", "{44077776-21C3-4271-A74A-1ED1CDA862A4}" ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject Global GlobalSection(SolutionConfiguration) = preSolution Debug = Debug Release = Release EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution {84D9CB1F-5FD9-4794-BF6F-58DB10CCB8FD}.Debug.ActiveCfg = Debug|Win32 {84D9CB1F-5FD9-4794-BF6F-58DB10CCB8FD}.Debug.Build.0 = Debug|Win32 {84D9CB1F-5FD9-4794-BF6F-58DB10CCB8FD}.Release.ActiveCfg = Release|Win32 {84D9CB1F-5FD9-4794-BF6F-58DB10CCB8FD}.Release.Build.0 = Release|Win32 {44077776-21C3-4271-A74A-1ED1CDA862A4}.Debug.ActiveCfg = Debug|Win32 {44077776-21C3-4271-A74A-1ED1CDA862A4}.Debug.Build.0 = Debug|Win32 {44077776-21C3-4271-A74A-1ED1CDA862A4}.Release.ActiveCfg = Release|Win32 {44077776-21C3-4271-A74A-1ED1CDA862A4}.Release.Build.0 = Release|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution EndGlobalSection GlobalSection(ExtensibilityAddIns) = postSolution EndGlobalSection EndGlobal --- build.bat DELETED --- --- NEW FILE: qt_example.vcproj --- <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" Version="7.10" Name="qt_example" ProjectGUID="{84D9CB1F-5FD9-4794-BF6F-58DB10CCB8FD}" SccProjectName="" SccLocalPath=""> <Platforms> <Platform Name="Win32"/> </Platforms> <Configurations> <Configuration Name="Release|Win32" OutputDirectory=".\Release" IntermediateDirectory=".\Release" ConfigurationType="1" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2"> <Tool Name="VCCLCompilerTool" Optimization="2" InlineFunctionExpansion="1" AdditionalIncludeDirectories="..\..\include;$(QTDIR)\include" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" StringPooling="TRUE" RuntimeLibrary="2" EnableFunctionLevelLinking="TRUE" RuntimeTypeInfo="TRUE" PrecompiledHeaderFile="" AssemblerListingLocation=".\Release/" ObjectFile=".\Release/" ProgramDataBaseFileName=".\Release/" WarningLevel="3" SuppressStartupBanner="TRUE" CompileAs="0"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" AdditionalDependencies="cppunit.lib qttestrunner.lib qt-mt335.lib odbc32.lib odbccp32.lib" OutputFile=".\Release\qt_example.exe" LinkIncremental="1" SuppressStartupBanner="TRUE" AdditionalLibraryDirectories="..\..\lib,$(QTDIR)\lib" IgnoreDefaultLibraryNames="libc" ProgramDatabaseFile="" SubSystem="1" TargetMachine="1"/> <Tool Name="VCMIDLTool" TypeLibraryName=".\Release/SampleUnitTest.tlb" HeaderFileName=""/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="2055"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> <Configuration Name="Debug|Win32" OutputDirectory=".\Debug" IntermediateDirectory=".\Debug" ConfigurationType="1" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2"> <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\include;$(QTDIR)\include" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" BasicRuntimeChecks="0" RuntimeLibrary="3" RuntimeTypeInfo="TRUE" PrecompiledHeaderFile="" AssemblerListingLocation=".\Debug/" ObjectFile=".\Debug/" ProgramDataBaseFileName=".\Debug/" WarningLevel="3" SuppressStartupBanner="TRUE" DebugInformationFormat="3" CompileAs="0"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" AdditionalDependencies="cppunitd.lib qttestrunnerd.lib qt-mt335.lib odbc32.lib odbccp32.lib" OutputFile=".\Debug\qt_example.exe" LinkIncremental="0" SuppressStartupBanner="TRUE" AdditionalLibraryDirectories="..\..\lib,$(QTDIR)\lib" IgnoreDefaultLibraryNames="libc,libcd,msvcrt" GenerateDebugInformation="TRUE" ProgramDatabaseFile=".\Debug\qt_example.pdb" SubSystem="1" TargetMachine="1"/> <Tool Name="VCMIDLTool" TypeLibraryName=".\Debug/SampleUnitTest.tlb" HeaderFileName=""/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="2055"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> </Configurations> <References> </References> <Files> <Filter Name="Source Files" Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"> <File RelativePath=".\ExampleTestCases.cpp"> </File> <File RelativePath=".\Main.cpp"> </File> </Filter> <Filter Name="Header Files" Filter="h;hpp;hxx;hm;inl"> <File RelativePath=".\ExampleTestCases.h"> </File> </Filter> </Files> <Globals> </Globals> </VisualStudioProject> Index: ExampleTestCases.h =================================================================== RCS file: /cvsroot/cppunit/cppunit/examples/qt/ExampleTestCases.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExampleTestCases.h 12 Dec 2005 07:40:09 -0000 1.1 --- ExampleTestCases.h 1 Feb 2006 21:10:59 -0000 1.2 *************** *** 1,4 **** ! #ifndef CPP_UNIT_EXAMPLETESTCASE_H ! #define CPP_UNIT_EXAMPLETESTCASE_H #include <cppunit/TestFixture.h> --- 1,4 ---- ! #ifndef CPP_UNIT_EXAMPLETESTCASES_H ! #define CPP_UNIT_EXAMPLETESTCASES_H #include <cppunit/TestFixture.h> *************** *** 7,40 **** /* * A test case that is designed to produce ! * example errors and failures * */ ! class ExampleTestCase : public CPPUNIT_NS::TestFixture { ! CPPUNIT_TEST_SUITE( ExampleTestCase ); CPPUNIT_TEST( example ); CPPUNIT_TEST( anotherExample ); CPPUNIT_TEST( testAdd ); CPPUNIT_TEST( testEquals ); CPPUNIT_TEST_SUITE_END(); - protected: ! double m_value1; ! double m_value2; public: ! void setUp (); protected: - void example (); - void anotherExample (); - void testAdd (); - void testDivideByZero (); - void testEquals (); }; - #endif --- 7,40 ---- /* * A test case that is designed to produce ! * example errors and failures. * */ ! class ExampleTestCases : public CPPUNIT_NS::TestFixture { ! CPPUNIT_TEST_SUITE( ExampleTestCases ); CPPUNIT_TEST( example ); CPPUNIT_TEST( anotherExample ); CPPUNIT_TEST( testAdd ); + CPPUNIT_TEST( testDivideByZero ); CPPUNIT_TEST( testEquals ); CPPUNIT_TEST_SUITE_END(); ! protected: + double m_value1; + double m_value2; public: ! void setUp (); protected: + void example (); + void anotherExample (); + void testAdd (); + void testDivideByZero (); + void testEquals (); }; #endif Index: ExampleTestCases.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit/examples/qt/ExampleTestCases.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExampleTestCases.cpp 12 Dec 2005 07:40:09 -0000 1.1 --- ExampleTestCases.cpp 1 Feb 2006 21:10:59 -0000 1.2 *************** *** 1,7 **** #include "ExampleTestCases.h" ! CPPUNIT_TEST_SUITE_REGISTRATION( ExampleTestCase ); ! void ExampleTestCase::example () { CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, 1.1, 0.05); --- 1,7 ---- #include "ExampleTestCases.h" ! CPPUNIT_TEST_SUITE_REGISTRATION( ExampleTestCases ); ! void ExampleTestCases::example () { CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, 1.1, 0.05); *************** *** 10,20 **** } ! ! void ExampleTestCase::anotherExample () { CPPUNIT_ASSERT (1 == 2); } ! void ExampleTestCase::setUp () { m_value1 = 2.0; --- 10,19 ---- } ! void ExampleTestCases::anotherExample () { CPPUNIT_ASSERT (1 == 2); } ! void ExampleTestCases::setUp () { m_value1 = 2.0; *************** *** 22,26 **** } ! void ExampleTestCase::testAdd () { double result = m_value1 + m_value2; --- 21,25 ---- } ! void ExampleTestCases::testAdd () { double result = m_value1 + m_value2; *************** *** 28,33 **** } ! void ExampleTestCase::testEquals () { std::auto_ptr<long> l1 (new long (12)); --- 27,37 ---- } + void ExampleTestCases::testDivideByZero () + { + int zero = 0; + int result = 8 / zero; + } ! void ExampleTestCases::testEquals () { std::auto_ptr<long> l1 (new long (12)); --- NEW FILE: make_example.bat --- @REM make_example.bat @REM @REM Create Makefile from project file and then make QtTestRunner example. qmake qt_example.pro nmake distclean nmake --- NEW FILE: qt_example_dll.vcproj --- <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" Version="7.10" Name="qt_example_dll" ProjectGUID="{44077776-21C3-4271-A74A-1ED1CDA862A4}" SccProjectName="" SccLocalPath=""> <Platforms> <Platform Name="Win32"/> </Platforms> <Configurations> <Configuration Name="Release|Win32" OutputDirectory=".\ReleaseDLL" IntermediateDirectory=".\ReleaseDLL" ConfigurationType="1" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2"> <Tool Name="VCCLCompilerTool" Optimization="2" InlineFunctionExpansion="1" AdditionalIncludeDirectories="..\..\include;$(QTDIR)\include" PreprocessorDefinitions="QTTESTRUNNER_DLL;WIN32;NDEBUG;_CONSOLE" StringPooling="TRUE" RuntimeLibrary="2" EnableFunctionLevelLinking="TRUE" RuntimeTypeInfo="TRUE" PrecompiledHeaderFile="" AssemblerListingLocation=".\ReleaseDLL/" ObjectFile=".\ReleaseDLL/" ProgramDataBaseFileName=".\ReleaseDLL/" WarningLevel="3" SuppressStartupBanner="TRUE" CompileAs="0"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" AdditionalDependencies="cppunit_dll.lib qttestrunner_dll.lib qt-mt335.lib odbc32.lib odbccp32.lib" OutputFile=".\ReleaseDLL\qt_example.exe" LinkIncremental="1" SuppressStartupBanner="TRUE" AdditionalLibraryDirectories="..\..\lib;$(QTDIR)\lib" IgnoreDefaultLibraryNames="libc" ProgramDatabaseFile="" SubSystem="1" TargetMachine="1"/> <Tool Name="VCMIDLTool" TypeLibraryName=".\Release/SampleUnitTest.tlb" HeaderFileName=""/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="2055"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> <Configuration Name="Debug|Win32" OutputDirectory=".\DebugDLL" IntermediateDirectory=".\DebugDLL" ConfigurationType="1" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2"> <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\include;$(QTDIR)\include" PreprocessorDefinitions="QTTESTRUNNER_DLL;WIN32;_DEBUG;_CONSOLE" BasicRuntimeChecks="0" RuntimeLibrary="3" RuntimeTypeInfo="TRUE" PrecompiledHeaderFile="" AssemblerListingLocation=".\DebugDLL/" ObjectFile=".\DebugDLL/" ProgramDataBaseFileName=".\DebugDLL/" WarningLevel="3" SuppressStartupBanner="TRUE" DebugInformationFormat="3" CompileAs="0"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" AdditionalDependencies="cppunitd_dll.lib qttestrunnerd_dll.lib qt-mt335.lib odbc32.lib odbccp32.lib" OutputFile=".\DebugDLL\qt_example.exe" LinkIncremental="0" SuppressStartupBanner="TRUE" AdditionalLibraryDirectories="..\..\lib;$(QTDIR)\lib" IgnoreDefaultLibraryNames="libc,libcd,msvcrt" GenerateDebugInformation="TRUE" ProgramDatabaseFile=".\DebugDLL\qt_example.pdb" SubSystem="1" TargetMachine="1"/> <Tool Name="VCMIDLTool" TypeLibraryName=".\Debug/SampleUnitTest.tlb" HeaderFileName=""/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="2055"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> </Configurations> <References> </References> <Files> <Filter Name="Source Files" Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"> <File RelativePath=".\ExampleTestCases.cpp"> </File> <File RelativePath=".\Main.cpp"> </File> </Filter> <Filter Name="Header Files" Filter="h;hpp;hxx;hm;inl"> <File RelativePath=".\ExampleTestCases.h"> </File> </Filter> </Files> <Globals> </Globals> </VisualStudioProject> Index: qt_example.pro =================================================================== RCS file: /cvsroot/cppunit/cppunit/examples/qt/qt_example.pro,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** qt_example.pro 12 Dec 2005 07:40:09 -0000 1.1 --- qt_example.pro 1 Feb 2006 21:10:59 -0000 1.2 *************** *** 15,23 **** CONFIG -= release ! #CONFIG += qt warn_on debug use_static #CONFIG += qt warn_on release use_static #CONFIG += qt warn_on debug use_dll ! CONFIG += qt warn_on release use_dll #---------------------------------------------------------------------- --- 15,27 ---- CONFIG -= release ! CONFIG += qt warn_on debug use_static #CONFIG += qt warn_on release use_static #CONFIG += qt warn_on debug use_dll ! #CONFIG += qt warn_on release use_dll ! ! ! CPPUNIT_LIB_DIR = ../../lib # Location of libraries ! #---------------------------------------------------------------------- *************** *** 26,40 **** win32 { use_dll { DEFINES += QTTESTRUNNER_DLL debug { OBJECTS_DIR = DebugDLL ! LIBS += ..\..\lib\cppunitd_dll.lib ! LIBS += ..\..\lib\qttestrunnerd_dll.lib } release { OBJECTS_DIR = ReleaseDLL ! LIBS += ..\..\lib\cppunit_dll.lib ! LIBS += ..\..\lib\qttestrunner_dll.lib } } --- 30,52 ---- win32 { + # Suppress program database creation (should better be done + # in the qmake spec file) + QMAKE_CXXFLAGS_DEBUG += /Z7 + QMAKE_CXXFLAGS_DEBUG -= -Gm + QMAKE_CXXFLAGS_DEBUG -= -Zi + } + + win32 { use_dll { DEFINES += QTTESTRUNNER_DLL debug { OBJECTS_DIR = DebugDLL ! LIBS += $${CPPUNIT_LIB_DIR}\cppunitd_dll.lib ! LIBS += $${CPPUNIT_LIB_DIR}\qttestrunnerd_dll.lib } release { OBJECTS_DIR = ReleaseDLL ! LIBS += $${CPPUNIT_LIB_DIR}\cppunit_dll.lib ! LIBS += $${CPPUNIT_LIB_DIR}\qttestrunner_dll.lib } } *************** *** 42,52 **** debug { OBJECTS_DIR = Debug ! LIBS += ..\..\lib\cppunitd.lib ! LIBS += ..\..\lib\qttestrunnerd.lib } release { OBJECTS_DIR = Release ! LIBS += ..\..\lib\cppunit.lib ! LIBS += ..\..\lib\qttestrunner.lib } } --- 54,64 ---- debug { OBJECTS_DIR = Debug ! LIBS += $${CPPUNIT_LIB_DIR}\cppunitd.lib ! LIBS += $${CPPUNIT_LIB_DIR}\qttestrunnerd.lib } release { OBJECTS_DIR = Release ! LIBS += $${CPPUNIT_LIB_DIR}\cppunit.lib ! LIBS += $${CPPUNIT_LIB_DIR}\qttestrunner.lib } } *************** *** 59,63 **** unix { ! message("NOT IMPLEMENTED YET!") } --- 71,86 ---- unix { ! debug { ! OBJECTS_DIR = .obj_debug ! use_static: LIBS += -L$${CPPUNIT_LIB_DIR} -lqttestrunnerd ! use_dll: LIBS += -L$${CPPUNIT_LIB_DIR} -lqttestrunnerd_shared ! LIBS += -L$${CPPUNIT_LIB_DIR} -lcppunit ! } ! release { ! OBJECTS_DIR = .obj_release ! use_static: LIBS += -L$${CPPUNIT_LIB_DIR} -lqttestrunner ! use_dll: LIBS += -L$${CPPUNIT_LIB_DIR} -lqttestrunner_shared ! LIBS += -L$${CPPUNIT_LIB_DIR} -lcppunit ! } } |