summaryrefslogtreecommitdiff
path: root/examples/cppunittest
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2002-04-20 20:54:36 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2002-04-20 20:54:36 +0000
commitf05089dffe81419786776b60bc2dc13d2a421a5c (patch)
tree8451a33146a505c999a28288fe4574e98f268238 /examples/cppunittest
parentc4995a9e022ed586cf4e3f166738dfe01bf51c16 (diff)
downloadcppunit-f05089dffe81419786776b60bc2dc13d2a421a5c.tar.gz
THANKS: updated
THANKS: updated * src/cppunit/DynamicLibraryManager.cpp: bugfix: did not pass library name to exception. * include/cppunit/TestPath.h: * src/cppunit/TestPath.cpp: changed into value object. * src/cppunit/BeosDynamicLibraryManager.cpp: integrated patch from Shibu Yoshiki for BeOS ('cuppa' project team). * src/DllPlugInTester/CommandLineParser.h: * src/DllPlugInTester/CommandLineParser.cpp: added. Command line parsing. * src/DllPlugInTester/DllPlugInTester.cpp: full command line support with parameters for plug-ins. * src/DllPlugInTester/makefile.am: * examples/simple/makefile.am: * examples/cppunittest/makefile.am: integrated Jeffrey Morgan patch, Unix side should be working again. * examples/ReadMe.txt: added. Brief description of each example. * examples/cppunittest/CppUnitTestPlugIn.cpp: * examples/cppunittest/CppUnitTestPlugIn.dsp: added. New project to build CppUnit's test suite as a test plug-in. * examples/cppunittest/CppUnitTestSuite.cpp: updated. Use new helper macros to create the test suite hierarchy. * examples/simple/simple_plugin.opt: added. Contains debug tab settings. * examples/ClockerPlugIn/ClockerListener.cpp: * examples/ClockerPlugIn/ClockerListener.h: * examples/ClockerPlugIn/Timer.cpp: * examples/ClockerPlugIn/Timer.h: * examples/ClockerPlugIn/WinNtTimer.cpp: * examples/ClockerPlugIn/WinNtTimer.h: * examples/ClockerPlugIn/ClockerPlugIn.cpp: * examples/ClockerPlugIn/ClockerPlugIn.dsp: added. test listener plug-in that times tests. * examples/DumperPlugIn/DumperListener.cpp: * examples/DumperPlugIn/DumperListener.h: * examples/DumperPlugIn/DumperPlugIn.cpp: * examples/DumperPlugIn/DumperPlugIn.dsp: added. test listener plug-in that dump the test tree.
Diffstat (limited to 'examples/cppunittest')
-rw-r--r--examples/cppunittest/CppUnitTestMain.cpp4
-rw-r--r--examples/cppunittest/CppUnitTestMain.dsp2
-rw-r--r--examples/cppunittest/CppUnitTestPlugIn.cpp5
-rw-r--r--examples/cppunittest/CppUnitTestPlugIn.dsp351
-rw-r--r--examples/cppunittest/CppUnitTestSuite.cpp33
-rw-r--r--examples/cppunittest/Makefile.am4
6 files changed, 371 insertions, 28 deletions
diff --git a/examples/cppunittest/CppUnitTestMain.cpp b/examples/cppunittest/CppUnitTestMain.cpp
index 68a6a1b..1e00009 100644
--- a/examples/cppunittest/CppUnitTestMain.cpp
+++ b/examples/cppunittest/CppUnitTestMain.cpp
@@ -5,7 +5,7 @@
#include <cppunit/TextTestProgressListener.h>
#include <cppunit/BriefTestProgressListener.h>
#include <cppunit/XmlOutputter.h>
-#include "CppUnitTestSuite.h"
+#include <cppunit/extensions/TestFactoryRegistry.h>
#include <stdexcept>
#include <fstream>
@@ -34,7 +34,7 @@ main( int argc, char* argv[] )
// Add the top suite to the test runner
CppUnit::TestRunner runner;
- runner.addTest( CppUnitTest::suite() );
+ runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() );
try
{
std::cout << "Running " << testPath;
diff --git a/examples/cppunittest/CppUnitTestMain.dsp b/examples/cppunittest/CppUnitTestMain.dsp
index e3a6a30..7dc4d52 100644
--- a/examples/cppunittest/CppUnitTestMain.dsp
+++ b/examples/cppunittest/CppUnitTestMain.dsp
@@ -117,7 +117,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../lib/cppunit.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../lib/cppunit_dll.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../lib/cppunit_dll.lib cppunit_dll.lib /nologo /subsystem:console /machine:I386
# Begin Special Build Tool
TargetPath=.\ReleaseDLL\CppUnitTestMain.exe
SOURCE="$(InputPath)"
diff --git a/examples/cppunittest/CppUnitTestPlugIn.cpp b/examples/cppunittest/CppUnitTestPlugIn.cpp
new file mode 100644
index 0000000..1517b11
--- /dev/null
+++ b/examples/cppunittest/CppUnitTestPlugIn.cpp
@@ -0,0 +1,5 @@
+#include <cppunit/plugin/TestPlugIn.h>
+
+
+// Implements all the plug-in stuffs, WinMain...
+CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/examples/cppunittest/CppUnitTestPlugIn.dsp b/examples/cppunittest/CppUnitTestPlugIn.dsp
new file mode 100644
index 0000000..54eaf5f
--- /dev/null
+++ b/examples/cppunittest/CppUnitTestPlugIn.dsp
@@ -0,0 +1,351 @@
+# Microsoft Developer Studio Project File - Name="CppUnitTestPlugIn" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=CppUnitTestPlugIn - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "CppUnitTestPlugIn.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "CppUnitTestPlugIn.mak" CFG="CppUnitTestPlugIn - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "CppUnitTestPlugIn - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "CppUnitTestPlugIn - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "CppUnitTestPlugIn - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "ReleasePlugIn"
+# PROP Intermediate_Dir "ReleasePlugIn"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CPPUNITTESTPLUGIN_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../include" /D "NDEBUG" /D "CPPUNITTESTPLUGIN_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CPPUNIT_DLL" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib cppunit_dll.lib /nologo /dll /machine:I386 /libpath:"../../lib/"
+
+!ELSEIF "$(CFG)" == "CppUnitTestPlugIn - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "DebugPlugIn"
+# PROP Intermediate_Dir "DebugPlugIn"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CPPUNITTESTPLUGIN_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "CPPUNIT_DLL" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x40c /d "_DEBUG"
+# ADD RSC /l 0x40c /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib cppunitd_dll.lib /nologo /dll /debug /machine:I386 /out:"DebugPlugIn/CppUnitTestPlugInd.dll" /pdbtype:sept /libpath:"../../lib/"
+
+!ENDIF
+
+# Begin Target
+
+# Name "CppUnitTestPlugIn - Win32 Release"
+# Name "CppUnitTestPlugIn - Win32 Debug"
+# Begin Group "Tests"
+
+# PROP Default_Filter ""
+# Begin Group "Core"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\ExceptionTest.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ExceptionTest.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NotEqualExceptionTest.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\NotEqualExceptionTest.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestAssertTest.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestAssertTest.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestCallerTest.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestCallerTest.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestCaseTest.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestCaseTest.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestFailureTest.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestFailureTest.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestPathTest.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestPathTest.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestResultTest.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestResultTest.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestSuiteTest.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestSuiteTest.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestTest.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestTest.h
+# End Source File
+# End Group
+# Begin Group "UnitTestTools"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\XmlUniformiser.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\XmlUniformiser.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\XmlUniformiserTest.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\XmlUniformiserTest.h
+# End Source File
+# End Group
+# Begin Group "Helper"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\HelperMacrosTest.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\HelperMacrosTest.h
+# End Source File
+# End Group
+# Begin Group "Extension"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\OrthodoxTest.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\OrthodoxTest.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\RepeatedTestTest.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\RepeatedTestTest.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestDecoratorTest.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestDecoratorTest.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestSetUpTest.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestSetUpTest.h
+# End Source File
+# End Group
+# Begin Group "Output"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\TestResultCollectorTest.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestResultCollectorTest.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\XmlOutputterTest.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\XmlOutputterTest.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "TestSupport"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\BaseTestCase.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\BaseTestCase.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\FailureException.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\MockTestCase.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\MockTestCase.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\MockTestListener.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\MockTestListener.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\SubclassedTestCase.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\SubclassedTestCase.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\SynchronizedTestResult.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TrackedTestCase.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TrackedTestCase.h
+# End Source File
+# End Group
+# Begin Group "Suites"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\CoreSuite.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CppUnitTestSuite.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ExtensionSuite.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\HelperSuite.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\OutputSuite.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\UnitTestToolSuite.h
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\CppUnitTestPlugIn.cpp
+# End Source File
+# End Target
+# End Project
diff --git a/examples/cppunittest/CppUnitTestSuite.cpp b/examples/cppunittest/CppUnitTestSuite.cpp
index 01f66cd..563caff 100644
--- a/examples/cppunittest/CppUnitTestSuite.cpp
+++ b/examples/cppunittest/CppUnitTestSuite.cpp
@@ -1,34 +1,17 @@
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "CppUnitTestSuite.h"
+#include <cppunit/extensions/HelperMacros.h>
#include "CoreSuite.h"
#include "HelperSuite.h"
#include "ExtensionSuite.h"
#include "OutputSuite.h"
#include "UnitTestToolSuite.h"
-
-namespace CppUnitTest
-{
-
-CppUnit::Test *
-suite()
+namespace CppUnitTest
{
- CppUnit::TestFactoryRegistry &registry =
- CppUnit::TestFactoryRegistry::getRegistry();
-
- registry.registerFactory(
- &CppUnit::TestFactoryRegistry::getRegistry( coreSuiteName() ) );
- registry.registerFactory(
- &CppUnit::TestFactoryRegistry::getRegistry( extensionSuiteName() ) );
- registry.registerFactory(
- &CppUnit::TestFactoryRegistry::getRegistry( helperSuiteName() ) );
- registry.registerFactory(
- &CppUnit::TestFactoryRegistry::getRegistry( outputSuiteName() ) );
- registry.registerFactory(
- &CppUnit::TestFactoryRegistry::getRegistry( unitTestToolSuiteName() ) );
-
- return registry.makeTest();
-}
+CPPUNIT_REGISTRY_ADD_TO_DEFAULT( coreSuiteName() );
+CPPUNIT_REGISTRY_ADD_TO_DEFAULT( extensionSuiteName() );
+CPPUNIT_REGISTRY_ADD_TO_DEFAULT( helperSuiteName() );
+CPPUNIT_REGISTRY_ADD_TO_DEFAULT( outputSuiteName() );
+CPPUNIT_REGISTRY_ADD_TO_DEFAULT( unitTestToolSuiteName() );
-} // namespace CppUnitTest
+} \ No newline at end of file
diff --git a/examples/cppunittest/Makefile.am b/examples/cppunittest/Makefile.am
index bae0a8c..d867378 100644
--- a/examples/cppunittest/Makefile.am
+++ b/examples/cppunittest/Makefile.am
@@ -67,3 +67,7 @@ cppunittestmain_SOURCES = \
cppunittestmain_LDADD= \
$(top_builddir)/src/cppunit/libcppunit.la
+
+cppunittestmain_LDFLAGS = -ldl
+
+