diff options
| author | Baptiste Lepilleur <gaiacrtn@free.fr> | 2002-04-20 20:54:36 +0000 |
|---|---|---|
| committer | Baptiste Lepilleur <gaiacrtn@free.fr> | 2002-04-20 20:54:36 +0000 |
| commit | f05089dffe81419786776b60bc2dc13d2a421a5c (patch) | |
| tree | 8451a33146a505c999a28288fe4574e98f268238 | |
| parent | c4995a9e022ed586cf4e3f166738dfe01bf51c16 (diff) | |
| download | cppunit-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.
51 files changed, 2175 insertions, 158 deletions
@@ -1,3 +1,57 @@ +2002-04-21 Baptiste Lepilleur <gaiacrtn@free.fr> + + * 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. + + 2002-04-19 Baptiste Lepilleur <gaiacrtn@free.fr> * src/cppunit/PlugInManager.cpp: fixed bug in unload(). @@ -1,3 +1,9 @@ + New in CppUnit 1.9.6: + ---------------------- + +This release makes testable components a reality with more versatile, easier to make test plug-ins, and a new crossplatform test plug-in runner. Many little things to make life easier: a brief test progress listener, easier test hierarchy creation, tracking of test runs, and an improved documentation. It also features new contributions: a XML style sheet and Borland 5.5 makefiles. Help needed on the Unix side with configure and automake. + + New in CppUnit 1.9.4: ---------------------- @@ -7,3 +7,5 @@ Peer Sommerlund Duane Murphy <duanem@users.sourceforge.net> Gigi Sayfan <gigi@morphink.com> Armin "bored" Michel <bored@sourceforge.net> +Jeffrey Morgan <kuzman@zoominternet.net> +'cuppa' project team (http://sourceforge.jp/projects/cuppa/)
\ No newline at end of file @@ -33,8 +33,10 @@ - [DONE] Wrap test plug-in suite retreival in a TestPlugInSuite. - [DONE] CrossPlatform TestPlugInSuite and TestPlugInInterface. - [DONE] CrossPlatform test runner for TestPlugIn. - - Advanced command line support for the plug-in runner + - [DONE] Advanced command line support for the plug-in runner (--xml, --compiler...) + plug-in parameter support. + - Custom Test macro helper + => naming convention Test *makeTest() - STL orthodox template for container elements. diff --git a/configure.in b/configure.in index 3fa786e..03dd604 100644 --- a/configure.in +++ b/configure.in @@ -15,7 +15,7 @@ AC_PREREQ(2.50) # CPPUNIT_MAJOR_VERSION=1 CPPUNIT_MINOR_VERSION=9 -CPPUNIT_MICRO_VERSION=4 +CPPUNIT_MICRO_VERSION=5 CPPUNIT_INTERFACE_AGE=0 CPPUNIT_BINARY_AGE=0 CPPUNIT_VERSION=$CPPUNIT_MAJOR_VERSION.$CPPUNIT_MINOR_VERSION.$CPPUNIT_MICRO_VERSION diff --git a/doc/CppUnit-win.dox b/doc/CppUnit-win.dox index efa1070..fe0904d 100644 --- a/doc/CppUnit-win.dox +++ b/doc/CppUnit-win.dox @@ -304,7 +304,7 @@ WARN_LOGFILE = CppUnit-dox.log INPUT = ../include \ ../src/cppunit \ other_documentation.dox \ - cookbook.dox + cookbook.dox Money.dox # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp diff --git a/examples/ClockerPlugIn/ClockerListener.cpp b/examples/ClockerPlugIn/ClockerListener.cpp new file mode 100644 index 0000000..fafbaf8 --- /dev/null +++ b/examples/ClockerPlugIn/ClockerListener.cpp @@ -0,0 +1,192 @@ +// ////////////////////////////////////////////////////////////////////////// +// Implementation file ClockerListener.cpp for class ClockerListener +// (c)Copyright 2000, Baptiste Lepilleur. +// Created: 2002/04/19 +// ////////////////////////////////////////////////////////////////////////// +#include <cppunit/Test.h> +#include <iostream> +#include "ClockerListener.h" +#include <stdio.h> + + +ClockerListener::ClockerListener( bool flatten ) + : m_flatten( flatten ) + , m_testCount( 0 ) + , m_totalTestCaseTime( 0 ) +{ +} + + +ClockerListener::~ClockerListener() +{ +} + + +void +ClockerListener::startTestRun( CppUnit::Test *test, + CppUnit::TestResult *eventManager ) +{ + m_tests.reserve( test->countTestCases() *2 ); +} + + +void +ClockerListener::startTest( CppUnit::Test *test ) +{ + enterTest( test, false ); + ++m_testCount; +} + + +void +ClockerListener::endTest( CppUnit::Test *test ) +{ + exitTest( test, false ); +} + + +void +ClockerListener::startSuite( CppUnit::Test *suite ) +{ + enterTest( suite, true ); +} + + +void +ClockerListener::endSuite( CppUnit::Test *suite ) +{ + exitTest( suite, true ); +} + + +void +ClockerListener::endTestRun( CppUnit::Test *test, + CppUnit::TestResult *eventManager ) +{ + printStatistics(); +} + + +void +ClockerListener::enterTest( CppUnit::Test *test, + bool isSuite ) +{ + m_currentPath.add( test ); + + int testIndex = m_tests.size(); + if ( !m_testIndexes.empty() ) + m_tests[ m_testIndexes.top() ].m_childIndexes.push_back( testIndex ); + m_testIndexes.push( testIndex ); + + TestInfo info; + info.m_timer.start(); + info.m_path = m_currentPath; + info.m_isSuite = isSuite; + + m_tests.push_back( info ); +} + + +void +ClockerListener::exitTest( CppUnit::Test *test, + bool isSuite ) +{ + m_tests[ m_testIndexes.top() ].m_timer.finish(); + m_totalTestCaseTime += m_tests.back().m_timer.elapsedTime(); + + m_currentPath.up(); + m_testIndexes.pop(); +} + + +void +ClockerListener::printStatistics() const +{ + printTest( m_tests[0], "" ); + std::cout << std::endl; + std::cout << "Total elapsed time: "; + printTestTime( m_tests[0].m_timer.elapsedTime() ); + std::cout << ", average test case time: "; + double average = 0; + if ( m_testCount > 0 ) + average = m_totalTestCaseTime / m_testCount; + printTestTime( average ); +} + + +void +ClockerListener::printTest( const TestInfo &info, + const std::string &indentString ) const +{ + std::string indent = indentString; + const int indentLength = 3; + + if ( !m_flatten ) + printTestIndent( indentString, indentLength ); + + printTestTime( info.m_timer.elapsedTime() ); + + if ( m_flatten ) + printFlattenedTestName( info ); + else + printTestName( info ); + + std::cout << std::endl; + + if ( info.m_childIndexes.empty() ) + indent+= std::string( indentLength, ' ' ); + else + indent+= "|" + std::string( indentLength -1, ' ' ); + + for ( int index =0; index < info.m_childIndexes.size(); ++index ) + printTest( m_tests[ info.m_childIndexes[ index ] ], indent ); +} + + +void +ClockerListener::printTestIndent( const std::string &indent, + const int indentLength ) const +{ + if ( indent.empty() ) + return; + + std::cout << " "; + std::cout << indent.substr( 0, indent.length() - indentLength ) ; + std::cout << "+" << std::string( indentLength -1, '-' ); +} + + +void +ClockerListener::printTestTime( double elapsedSeconds ) const +{ + char buffer[320]; + const char *format; + if ( elapsedSeconds < 1 ) + format = "(%2.3fs) "; + else if ( elapsedSeconds < 10 ) + format = "(%3.2fs) "; + else if (elapsedSeconds < 100 ) + format = "(%4.1fs) "; + else + format = "(%5fs) "; + + ::sprintf( buffer, format, elapsedSeconds ); + + std::cout << buffer; +} + + +void +ClockerListener::printFlattenedTestName( const TestInfo &info ) const +{ + std::cout << info.m_path.toString(); + if ( info.m_isSuite ) + std::cout << "/"; +} + + +void +ClockerListener::printTestName( const TestInfo &info ) const +{ + std::cout << info.m_path.getChildTest()->getName(); +} diff --git a/examples/ClockerPlugIn/ClockerListener.h b/examples/ClockerPlugIn/ClockerListener.h new file mode 100644 index 0000000..b256380 --- /dev/null +++ b/examples/ClockerPlugIn/ClockerListener.h @@ -0,0 +1,96 @@ +// ////////////////////////////////////////////////////////////////////////// +// Header file ClockerListener.h for class ClockerListener +// (c)Copyright 2000, Baptiste Lepilleur. +// Created: 2002/04/19 +// ////////////////////////////////////////////////////////////////////////// +#ifndef CLOCKERLISTENER_H +#define CLOCKERLISTENER_H + +#include <cppunit/TestListener.h> +#include <cppunit/TestPath.h> +#include <stack> +#include <vector> + +#ifdef CLOCKER_USE_WINNTTIMER +#include "WinNtTimer.h" +typedef WinNtTimer Timer; +#else +#include "Timer.h" +#endif + +/// TestListener that prints a flatten or hierarchical view of the test tree. +class ClockerListener : public CppUnit::TestListener +{ +public: + ClockerListener( bool flatten ); + + virtual ~ClockerListener(); + + void startTestRun( CppUnit::Test *test, + CppUnit::TestResult *eventManager ); + + void startTest( CppUnit::Test *test ); + + void endTest( CppUnit::Test *test ); + + void startSuite( CppUnit::Test *suite ); + + void endSuite( CppUnit::Test *suite ); + + void endTestRun( CppUnit::Test *test, + CppUnit::TestResult *eventManager ); + +private: + struct TestInfo + { + CppUnit::TestPath m_path; + Timer m_timer; + bool m_isSuite; + std::vector<int> m_childIndexes; + }; + + void enterTest( CppUnit::Test *test, + bool isSuite ); + + void exitTest( CppUnit::Test *test, + bool isSuite ); + + void printStatistics() const; + + void printTest( const TestInfo &info, + const std::string &indentString ) const; + + void printTestIndent( const std::string &indent, + const int indentLength ) const; + + void printTestTime( double elapsedSeconds ) const; + + void printFlattenedTestName( const TestInfo &info ) const; + + void printTestName( const TestInfo &info ) const; + + /// Prevents the use of the copy constructor. + ClockerListener( const ClockerListener &other ); + + /// Prevents the use of the copy operator. + void operator =( const ClockerListener &other ); + +private: + bool m_flatten; + CppUnit::TestPath m_currentPath; + + int m_testCount; + double m_totalTestCaseTime; + + std::stack<int> m_testIndexes; + std::vector<TestInfo> m_tests; +}; + + + +// Inlines methods for ClockerListener: +// ----------------------------------- + + + +#endif // CLOCKERLISTENER_H diff --git a/examples/ClockerPlugIn/ClockerPlugIn.cpp b/examples/ClockerPlugIn/ClockerPlugIn.cpp new file mode 100644 index 0000000..8943629 --- /dev/null +++ b/examples/ClockerPlugIn/ClockerPlugIn.cpp @@ -0,0 +1,55 @@ +#include <cppunit/TestResult.h> +#include <cppunit/plugin/TestPlugIn.h> +#include "ClockerListener.h" + + + +class ClockerPlugIn : public CppUnitTestPlugIn +{ +public: + ClockerPlugIn() + : m_dumper( NULL ) + { + } + + ~ClockerPlugIn() + { + delete m_dumper; + } + + + void initialize( CppUnit::TestFactoryRegistry *registry, + const CppUnit::Parameters ¶meters ) + { + bool flatten = false; + if ( parameters.size() > 0 && parameters[0] == "flat" ) + flatten = true; + + m_dumper = new ClockerListener( flatten ); + } + + + void addListener( CppUnit::TestResult *eventManager ) + { + eventManager->addListener( m_dumper ); + } + + + void removeListener( CppUnit::TestResult *eventManager ) + { + eventManager->removeListener( m_dumper ); + } + + + void uninitialize( CppUnit::TestFactoryRegistry *registry ) + { + } + +private: + ClockerListener *m_dumper; +}; + + +CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL( ClockerPlugIn ); + +CPPUNIT_TESTPLUGIN_MAIN();
\ No newline at end of file diff --git a/examples/ClockerPlugIn/ClockerPlugIn.dsp b/examples/ClockerPlugIn/ClockerPlugIn.dsp new file mode 100644 index 0000000..98e206a --- /dev/null +++ b/examples/ClockerPlugIn/ClockerPlugIn.dsp @@ -0,0 +1,209 @@ +# Microsoft Developer Studio Project File - Name="ClockerPlugIn" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=ClockerPlugIn - Win32 Debug NtTimer +!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 "ClockerPlugIn.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 "ClockerPlugIn.mak" CFG="ClockerPlugIn - Win32 Debug NtTimer" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "ClockerPlugIn - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "ClockerPlugIn - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "ClockerPlugIn - Win32 Debug NtTimer" (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)" == "ClockerPlugIn - 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 "Release" +# PROP Intermediate_Dir "Release" +# 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 "CLOCKERPLUGIN_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CPPUNIT_DLL" /FD /c +# SUBTRACT CPP /YX +# 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 /out:"../../lib/ClockerPlugIn.dll" /libpath:"../../lib/" + +!ELSEIF "$(CFG)" == "ClockerPlugIn - 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 "Debug" +# PROP Intermediate_Dir "Debug" +# 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 "CLOCKERPLUGIN_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CPPUNIT_DLL" /FD /GZ /c +# SUBTRACT CPP /YX +# 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:"../../lib/ClockerPlugInd.dll" /pdbtype:sept /libpath:"../../lib/" + +!ELSEIF "$(CFG)" == "ClockerPlugIn - Win32 Debug NtTimer" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug NtTimer" +# PROP BASE Intermediate_Dir "Debug NtTimer" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "DebugNtTimer" +# PROP Intermediate_Dir "DebugNtTimer" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CPPUNIT_DLL" /FD /GZ /c +# SUBTRACT BASE CPP /YX +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CPPUNIT_DLL" /D "CLOCKER_USE_WINNTTIMER" /FD /GZ /c +# SUBTRACT CPP /YX +# 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 cppunitd_dll.lib /nologo /dll /debug /machine:I386 /out:"../../lib/ClockerPlugInd.dll" /pdbtype:sept /libpath:"../../lib/" +# 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:"../../lib/ClockerPlugInNtd.dll" /pdbtype:sept /libpath:"../../lib/" + +!ENDIF + +# Begin Target + +# Name "ClockerPlugIn - Win32 Release" +# Name "ClockerPlugIn - Win32 Debug" +# Name "ClockerPlugIn - Win32 Debug NtTimer" +# Begin Source File + +SOURCE=.\ClockerListener.cpp +# End Source File +# Begin Source File + +SOURCE=.\ClockerListener.h +# End Source File +# Begin Source File + +SOURCE=.\ClockerPlugIn.cpp +# End Source File +# Begin Source File + +SOURCE=.\Makefile.am +# End Source File +# Begin Source File + +SOURCE=.\Timer.cpp + +!IF "$(CFG)" == "ClockerPlugIn - Win32 Release" + +!ELSEIF "$(CFG)" == "ClockerPlugIn - Win32 Debug" + +!ELSEIF "$(CFG)" == "ClockerPlugIn - Win32 Debug NtTimer" + +# PROP Exclude_From_Build 1 + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\Timer.h + +!IF "$(CFG)" == "ClockerPlugIn - Win32 Release" + +!ELSEIF "$(CFG)" == "ClockerPlugIn - Win32 Debug" + +!ELSEIF "$(CFG)" == "ClockerPlugIn - Win32 Debug NtTimer" + +# PROP Exclude_From_Build 1 + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\WinNtTimer.cpp + +!IF "$(CFG)" == "ClockerPlugIn - Win32 Release" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "ClockerPlugIn - Win32 Debug" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "ClockerPlugIn - Win32 Debug NtTimer" + +# PROP BASE Exclude_From_Build 1 +# PROP Intermediate_Dir "DebugNtTimer" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\WinNtTimer.h + +!IF "$(CFG)" == "ClockerPlugIn - Win32 Release" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "ClockerPlugIn - Win32 Debug" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "ClockerPlugIn - Win32 Debug NtTimer" + +# PROP BASE Exclude_From_Build 1 + +!ENDIF + +# End Source File +# End Target +# End Project diff --git a/examples/ClockerPlugIn/Makefile.am b/examples/ClockerPlugIn/Makefile.am new file mode 100644 index 0000000..2d828c4 --- /dev/null +++ b/examples/ClockerPlugIn/Makefile.am @@ -0,0 +1,4 @@ +EXTRA_DIST = WinNtTimer.h Timer.h ClockerListener.h \ + Timer.cpp ClockerListener.cpp WinNtTimer.cpp \ + ClockerPlugIn.cpp ClockerPlugIn.dsp + diff --git a/examples/ClockerPlugIn/ReadMe.txt b/examples/ClockerPlugIn/ReadMe.txt new file mode 100644 index 0000000..6893fc6 --- /dev/null +++ b/examples/ClockerPlugIn/ReadMe.txt @@ -0,0 +1,14 @@ +A plug-ins that track tests and test suites running time. A demonstration of TestListener and +test plug-in. + +Don't use this to profile your application, use a Profiler. + +Usage: + +The plug-in accept the option "flat" to generate a flattened view of the test tree. + +DllPlugInRunnerd.exe ClockerPlugInd.dll +or +DllPlugInRunnerd.exe ClockerPlugInd.dll=flat + + diff --git a/examples/ClockerPlugIn/Timer.cpp b/examples/ClockerPlugIn/Timer.cpp new file mode 100644 index 0000000..6719817 --- /dev/null +++ b/examples/ClockerPlugIn/Timer.cpp @@ -0,0 +1,28 @@ +// ////////////////////////////////////////////////////////////////////////// +// Implementation file Timer.cpp for class Timer +// (c)Copyright 2000, Baptiste Lepilleur. +// Created: 2002/04/19 +// ////////////////////////////////////////////////////////////////////////// + +#include "Timer.h" + + +void +Timer::start() +{ + m_beginTime = clock(); +} + + +void +Timer::finish() +{ + m_elapsedTime = double(clock() - m_beginTime) / CLOCKS_PER_SEC; +} + + +double +Timer::elapsedTime() const +{ + return m_elapsedTime; +} diff --git a/examples/ClockerPlugIn/Timer.h b/examples/ClockerPlugIn/Timer.h new file mode 100644 index 0000000..e2b3449 --- /dev/null +++ b/examples/ClockerPlugIn/Timer.h @@ -0,0 +1,32 @@ +// ////////////////////////////////////////////////////////////////////////// +// Header file Timer.h for class Timer +// (c)Copyright 2000, Baptiste Lepilleur. +// Created: 2002/04/19 +// ////////////////////////////////////////////////////////////////////////// +#ifndef TIMER_H +#define TIMER_H + +#include <time.h> + +/// A Timer. +class Timer +{ +public: + void start(); + void finish(); + + double elapsedTime() const; + +private: + clock_t m_beginTime; + double m_elapsedTime; +}; + + + +// Inlines methods for Timer: +// -------------------------- + + + +#endif // TIMER_H diff --git a/examples/ClockerPlugIn/WinNtTimer.cpp b/examples/ClockerPlugIn/WinNtTimer.cpp new file mode 100644 index 0000000..87546a2 --- /dev/null +++ b/examples/ClockerPlugIn/WinNtTimer.cpp @@ -0,0 +1,77 @@ +// ////////////////////////////////////////////////////////////////////////// +// Implementation file WinNtTimer.cpp for class WinNtTimer +// (c)Copyright 2000, Baptiste Lepilleur. +// Created: 2002/04/19 +// ////////////////////////////////////////////////////////////////////////// + +#include "WinNtTimer.h" + + +/*! Returns time spent in the thread. + * @param rquadTime Receive the time spent in the thread (user+kernel time) + * in unit of 100 nano-seconds. + * In pratice, the effective resolution is 10ms !!! + * + * @return \c true if sucess, \c false otherwise. + */ +static bool +GetThreadSpentTime( LONGLONG &rquadTime ) +{ + FILETIME timeCreation; + FILETIME timeExit; + FILETIME timeKernel; + FILETIME timeUser; + if ( !::GetThreadTimes( ::GetCurrentThread(), + &timeCreation, + &timeExit, + &timeKernel, + &timeUser) ) + { + rquadTime = 0; + return false; + } + + LARGE_INTEGER lintKernel; + lintKernel.LowPart = timeKernel.dwLowDateTime; + lintKernel.HighPart = timeKernel.dwHighDateTime; + + LARGE_INTEGER lintUser; + lintUser.LowPart = timeUser.dwLowDateTime; + lintUser.HighPart = timeUser.dwHighDateTime; + + rquadTime = lintKernel.QuadPart + lintUser.QuadPart; + + return true; +} + + + +void +WinNtTimer::start() +{ + m_isValid = GetThreadSpentTime( m_beginTime ); + +} + + +void +WinNtTimer::finish() +{ + LONGLONG quadTimeEnd; + LONGLONG quadProcessedElapse; + m_isValid = m_isValid && GetThreadSpentTime( quadTimeEnd ); + if ( m_isValid ) + { + quadProcessedElapse = quadTimeEnd - m_beginTime; + m_elapsedTime = double(quadProcessedElapse) / 10000000; + } + else + m_elapsedTime = -1; +} + + +double +WinNtTimer::elapsedTime() const +{ + return m_elapsedTime; +} diff --git a/examples/ClockerPlugIn/WinNtTimer.h b/examples/ClockerPlugIn/WinNtTimer.h new file mode 100644 index 0000000..fa871b9 --- /dev/null +++ b/examples/ClockerPlugIn/WinNtTimer.h @@ -0,0 +1,36 @@ +// ////////////////////////////////////////////////////////////////////////// +// Header file WinNtTimer.h for class WinNtTimer +// (c)Copyright 2000, Baptiste Lepilleur. +// Created: 2002/04/19 +// ////////////////////////////////////////////////////////////////////////// +#ifndef WINNTTIMER_H +#define WINNTTIMER_H + +#include <windows.h> +#include <winnt.h> +#include <winbase.h> + + +/// A Timer. +class WinNtTimer +{ +public: + void start(); + void finish(); + + double elapsedTime() const; + +private: + LONGLONG m_beginTime; + double m_elapsedTime; + bool m_isValid; +}; + + + +// Inlines methods for Timer: +// -------------------------- + + + +#endif // WINNTTIMER_H diff --git a/examples/DumperPlugIn/DumperListener.cpp b/examples/DumperPlugIn/DumperListener.cpp new file mode 100644 index 0000000..3e6a5cb --- /dev/null +++ b/examples/DumperPlugIn/DumperListener.cpp @@ -0,0 +1,120 @@ +// ////////////////////////////////////////////////////////////////////////// +// Implementation file DumperListener.cpp for class DumperListener +// (c)Copyright 2000, Baptiste Lepilleur. +// Created: 2002/04/19 +// ////////////////////////////////////////////////////////////////////////// +#include <cppunit/Test.h> +#include <iostream> +#include "DumperListener.h" + +DumperListener::DumperListener( bool flatten ) + : m_flatten( flatten ) + , m_suiteCount( 0 ) + , m_testCount( 0 ) + , m_suiteWithTestCount( 0 ) +{ +} + + +DumperListener::~DumperListener() +{ +} + + +void +DumperListener::startTest( CppUnit::Test *test ) +{ + printPath( test, false ); + ++m_testCount; +} + + +void +DumperListener::endTest( CppUnit::Test *test ) +{ + m_path.up(); + if ( !m_suiteHasTest.empty() ) + { + m_suiteHasTest.pop(); + m_suiteHasTest.push( true ); + } +} + + +void +DumperListener::startSuite( CppUnit::Test *suite ) +{ + printPath( suite, true ); + ++m_suiteCount; + m_suiteHasTest.push( false ); +} + + +void +DumperListener::endSuite( CppUnit::Test *suite ) +{ + m_path.up(); + if ( m_suiteHasTest.top() ) + ++m_suiteWithTestCount; + m_suiteHasTest.pop(); +} + + +void +DumperListener::endTestRun( CppUnit::Test *test, + CppUnit::TestResult *eventManager ) +{ + double average = 0; + if ( m_suiteWithTestCount > 0 ) + average = double(m_testCount) / m_suiteWithTestCount; + + std::cout << "Statistics: " << m_testCount << " test cases, " + << m_suiteCount << " suites, " + << average << " test cases / suite with test cases" + << std::endl; +} + + +void +DumperListener::printPath( CppUnit::Test *test, + bool isSuite ) +{ + m_path.add( test ); + + if ( m_flatten ) + printFlattenedPath( isSuite ); + else + printIndentedPathChild(); +} + + +void +DumperListener::printFlattenedPath( bool isSuite ) +{ + std::string path = m_path.toString(); + if ( isSuite ) + path += "/"; + std::cout << path << std::endl; +} + + +void +DumperListener::printIndentedPathChild() +{ + std::string indent = makeIndentString( m_path.getTestCount() -1 ); + std::cout << indent << m_path.getChildTest()->getName() << std::endl; +} + + +std::string +DumperListener::makeIndentString( int indentLevel ) +{ + std::string indent; + for ( int parentIndent =0; parentIndent < indentLevel-1; ++parentIndent ) + indent += "| "; + + if ( indentLevel > 0 ) + indent += "+--"; + + return indent; +} diff --git a/examples/DumperPlugIn/DumperListener.h b/examples/DumperPlugIn/DumperListener.h new file mode 100644 index 0000000..d048929 --- /dev/null +++ b/examples/DumperPlugIn/DumperListener.h @@ -0,0 +1,67 @@ +// ////////////////////////////////////////////////////////////////////////// +// Header file DumperListener.h for class DumperListener +// (c)Copyright 2000, Baptiste Lepilleur. +// Created: 2002/04/19 +// ////////////////////////////////////////////////////////////////////////// +#ifndef DUMPERLISTENER_H +#define DUMPERLISTENER_H + +#include <cppunit/TestListener.h> +#include <cppunit/TestPath.h> +#include <stack> + + +/// TestListener that prints a flatten or hierarchical view of the test tree. +class DumperListener : public CppUnit::TestListener +{ +public: + DumperListener( bool flatten ); + + virtual ~DumperListener(); + + void startTest( CppUnit::Test *test ); + + void endTest( CppUnit::Test *test ); + + void startSuite( CppUnit::Test *suite ); + + void endSuite( CppUnit::Test *suite ); + + void endTestRun( CppUnit::Test *test, + CppUnit::TestResult *eventManager ); + +private: + /// Prevents the use of the copy constructor. + DumperListener( const DumperListener &other ); + + /// Prevents the use of the copy operator. + void operator =( const DumperListener &other ); + + void printPath( CppUnit::Test *test, + bool isSuite ); + + void printFlattenedPath( bool isSuite ); + + void printIndentedPathChild(); + + std::string makeIndentString( int indentLevel ); + +private: + bool m_flatten; + CppUnit::TestPath m_path; + + int m_suiteCount; + int m_testCount; + int m_suiteWithTestCount; + + std::stack<bool> m_suiteHasTest; +}; + + + +// Inlines methods for DumperListener: +// ----------------------------------- + + + +#endif // DUMPERLISTENER_H diff --git a/examples/DumperPlugIn/DumperPlugIn.cpp b/examples/DumperPlugIn/DumperPlugIn.cpp new file mode 100644 index 0000000..0131d14 --- /dev/null +++ b/examples/DumperPlugIn/DumperPlugIn.cpp @@ -0,0 +1,55 @@ +#include <cppunit/TestResult.h> +#include <cppunit/plugin/TestPlugIn.h> +#include "DumperListener.h" + + + +class DumperPlugIn : public CppUnitTestPlugIn +{ +public: + DumperPlugIn() + : m_dumper( NULL ) + { + } + + ~DumperPlugIn() + { + delete m_dumper; + } + + + void initialize( CppUnit::TestFactoryRegistry *registry, + const CppUnit::Parameters ¶meters ) + { + bool flatten = false; + if ( parameters.size() > 0 && parameters[0] == "flat" ) + flatten = true; + + m_dumper = new DumperListener( flatten ); + } + + + void addListener( CppUnit::TestResult *eventManager ) + { + eventManager->addListener( m_dumper ); + } + + + void removeListener( CppUnit::TestResult *eventManager ) + { + eventManager->removeListener( m_dumper ); + } + + + void uninitialize( CppUnit::TestFactoryRegistry *registry ) + { + } + +private: + DumperListener *m_dumper; +}; + + +CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL( DumperPlugIn ); + +CPPUNIT_TESTPLUGIN_MAIN();
\ No newline at end of file diff --git a/examples/DumperPlugIn/DumperPlugIn.dsp b/examples/DumperPlugIn/DumperPlugIn.dsp new file mode 100644 index 0000000..7498bd0 --- /dev/null +++ b/examples/DumperPlugIn/DumperPlugIn.dsp @@ -0,0 +1,107 @@ +# Microsoft Developer Studio Project File - Name="DumperPlugIn" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=DumperPlugIn - 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 "DumperPlugIn.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 "DumperPlugIn.mak" CFG="DumperPlugIn - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "DumperPlugIn - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "DumperPlugIn - 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)" == "DumperPlugIn - 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 "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 1 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DUMPERPLUGIN_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DUMPERPLUGIN_EXPORTS" /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 /out:"../../lib/DumperPlugIn.dll" /libpath:"../../lib/" + +!ELSEIF "$(CFG)" == "DumperPlugIn - 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 "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 1 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DUMPERPLUGIN_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DUMPERPLUGIN_EXPORTS" /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:"../../lib/DumperPlugInd.dll" /pdbtype:sept /libpath:"../../lib/" + +!ENDIF + +# Begin Target + +# Name "DumperPlugIn - Win32 Release" +# Name "DumperPlugIn - Win32 Debug" +# Begin Source File + +SOURCE=.\DumperListener.cpp +# End Source File +# Begin Source File + +SOURCE=.\DumperListener.h +# End Source File +# Begin Source File + +SOURCE=.\DumperPlugIn.cpp +# End Source File +# Begin Source File + +SOURCE=..\ClockerPlugIn\Makefile.am +# End Source File +# End Target +# End Project diff --git a/examples/DumperPlugIn/Makefile.am b/examples/DumperPlugIn/Makefile.am new file mode 100644 index 0000000..bb1f6d3 --- /dev/null +++ b/examples/DumperPlugIn/Makefile.am @@ -0,0 +1,2 @@ +EXTRA_DIST = DumperListener.h DumperListener.cpp DumperPlugIn.cpp \ + DumperPlugIn.dsp
\ No newline at end of file diff --git a/examples/Makefile.am b/examples/Makefile.am index f311edd..2dd2145 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = hierarchy cppunittest simple +SUBDIRS = hierarchy cppunittest simple ClockerPlugIn DumperPlugIn # No dist subdir for msvc6: is handled by toplevel dist-hook # DIST_SUBDIRS = msvc6 diff --git a/examples/ReadMe.txt b/examples/ReadMe.txt new file mode 100644 index 0000000..5359a0f --- /dev/null +++ b/examples/ReadMe.txt @@ -0,0 +1,21 @@ +simple/simple.dsp: A simple CppUnit's example. Basic TextTestRunner and a single 'standard' + TestFixture. A good starting point + +simple/simple_plugin.dsp: Like 'simple', but creates a test plug-in. The test plug-in can + be run with DllPlugInRunner. + +hierarchy/: A simple example that demonstrate the use of helper macros with template + and how to subclass TestFixture. + +cppunittest/: CppUnit's unit tests. Contains CppUnitTestMain which build an application + with CppUnit's tests, and which wrap the same unit tests into a test plug-in. + +ClockerPlugIn/: a 'TestListener' plug-in. Demonstrates the use of the test plug-in to +extends DllPlugInRunner. The test plug-in tracks the time each test and suite takes to run. + +DumperPlugIn/: a 'TestListener' plug-in that dumps the test hierarchy as a tree or in +a flattened format (using TestPath). + +msvc6/: VC++ specific examples. + HostApp/: Like 'simple' but use the MFC TestRunner. +qt/: QT specific examples. 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 ®istry = - 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 + + diff --git a/examples/examples.dsw b/examples/examples.dsw index 46a1fac..038cec6 100644 --- a/examples/examples.dsw +++ b/examples/examples.dsw @@ -3,6 +3,21 @@ Microsoft Developer Studio Workspace File, Format Version 6.00 ############################################################################### +Project: "ClockerPlugIn"=.\ClockerPlugIn\ClockerPlugIn.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name cppunit_dll + End Project Dependency +}}} + +############################################################################### + Project: "CppUnitTestApp"=.\msvc6\CppUnitTestApp\CppUnitTestApp.dsp - Package Owner=<4> Package=<5> @@ -36,6 +51,21 @@ Package=<4> ############################################################################### +Project: "CppUnitTestPlugIn"=.\cppunittest\CppUnitTestPlugIn.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name cppunit_dll + End Project Dependency +}}} + +############################################################################### + Project: "DllPlugInTester"=..\src\DllPlugInTester\DllPlugInTester.dsp - Package Owner=<4> Package=<5> @@ -51,6 +81,21 @@ Package=<4> ############################################################################### +Project: "DumperPlugIn"=.\DumperPlugIn\DumperPlugIn.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name cppunit_dll + End Project Dependency +}}} + +############################################################################### + Project: "HostApp"=.\msvc6\HostApp\HostApp.dsp - Package Owner=<4> Package=<5> diff --git a/examples/examples.opt b/examples/examples.opt Binary files differindex e7275a2..8b647af 100644 --- a/examples/examples.opt +++ b/examples/examples.opt diff --git a/examples/msvc6/CppUnitTestApp/CppUnitTestApp.clw b/examples/msvc6/CppUnitTestApp/CppUnitTestApp.clw deleted file mode 100644 index 6a47c0a..0000000 --- a/examples/msvc6/CppUnitTestApp/CppUnitTestApp.clw +++ /dev/null @@ -1,74 +0,0 @@ -; CLW file contains information for the MFC ClassWizard - -[General Info] -Version=1 -LastClass=CppUnitTestAppDlg -LastTemplate=CDialog -NewFileInclude1=#include "stdafx.h" -NewFileInclude2=#include "CppUnitTestApp.h" - -ClassCount=4 -Class1=CppUnitTestApp -Class2=CppUnitTestAppDlg -Class3=CAboutDlg - -ResourceCount=5 -Resource1=IDD_ABOUTBOX -Resource2=IDR_MAINFRAME -Resource3=IDD_CPPUNITTESTAPP_DIALOG -Resource4=IDD_CPPUNITTESTAPP_DIALOG (English (U.S.)) -Resource5=IDD_ABOUTBOX (English (U.S.)) - -[CLS:CppUnitTestApp] -Type=0 -HeaderFile=CppUnitTestApp.h -ImplementationFile=CppUnitTestApp.cpp -Filter=N - -[CLS:CppUnitTestAppDlg] -Type=0 -HeaderFile=CppUnitTestAppDlg.h -ImplementationFile=CppUnitTestAppDlg.cpp -Filter=D - -[CLS:CAboutDlg] -Type=0 -HeaderFile=CppUnitTestAppDlg.h -ImplementationFile=CppUnitTestAppDlg.cpp -Filter=D - -[DLG:IDD_ABOUTBOX] -Type=1 -ControlCount=4 -Control1=IDC_STATIC,static,1342177283 -Control2=IDC_STATIC,static,1342308352 -Control3=IDC_STATIC,static,1342308352 -Control4=IDOK,button,1342373889 -Class=CAboutDlg - - -[DLG:IDD_CPPUNITTESTAPP_DIALOG] -Type=1 -ControlCount=3 -Control1=IDOK,button,1342242817 -Control2=IDCANCEL,button,1342242816 -Control3=IDC_STATIC,static,1342308352 -Class=CppUnitTestAppDlg - -[DLG:IDD_CPPUNITTESTAPP_DIALOG (English (U.S.))] -Type=1 -Class=? -ControlCount=3 -Control1=IDOK,button,1342242817 -Control2=IDCANCEL,button,1342242816 -Control3=IDC_STATIC,static,1342308352 - -[DLG:IDD_ABOUTBOX (English (U.S.))] -Type=1 -Class=? -ControlCount=4 -Control1=IDC_STATIC,static,1342177283 -Control2=IDC_STATIC,static,1342308480 -Control3=IDC_STATIC,static,1342308352 -Control4=IDOK,button,1342373889 - diff --git a/examples/msvc6/CppUnitTestApp/CppUnitTestApp.cpp b/examples/msvc6/CppUnitTestApp/CppUnitTestApp.cpp index d1d5f3c..242e3d6 100644 --- a/examples/msvc6/CppUnitTestApp/CppUnitTestApp.cpp +++ b/examples/msvc6/CppUnitTestApp/CppUnitTestApp.cpp @@ -6,7 +6,6 @@ #include "CppUnitTestAppDlg.h" #include <cppunit/ui/mfc/TestRunner.h> #include <cppunit/extensions/TestFactoryRegistry.h> -#include <cppunittest/CppUnitTestSuite.h> #ifdef _DEBUG #define new DEBUG_NEW @@ -72,7 +71,7 @@ CppUnitTestApp::RunTests() { CppUnit::MfcUi::TestRunner runner; - runner.addTest( CppUnitTest::suite() ); + runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() ); runner.run(); } diff --git a/examples/simple/ExampleTestCase.h b/examples/simple/ExampleTestCase.h index 7c993ee..b5d89e9 100644 --- a/examples/simple/ExampleTestCase.h +++ b/examples/simple/ExampleTestCase.h @@ -39,4 +39,5 @@ protected: }; -#endif
\ No newline at end of file +#endif +
\ No newline at end of file diff --git a/examples/simple/Makefile.am b/examples/simple/Makefile.am index 47e7d68..f9200de 100644 --- a/examples/simple/Makefile.am +++ b/examples/simple/Makefile.am @@ -9,3 +9,4 @@ simple_SOURCES= ExampleTestCase.cpp Main.cpp ExampleTestCase.h simple_LDADD= \ $(top_builddir)/src/cppunit/libcppunit.la +simple_LDFLAGS = -ldl
\ No newline at end of file diff --git a/examples/simple/simple.dsp b/examples/simple/simple.dsp index 2c90c37..2b80bd9 100644 --- a/examples/simple/simple.dsp +++ b/examples/simple/simple.dsp @@ -50,7 +50,7 @@ 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 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 /subsystem:console /machine:I386 +# 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 /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 cppunit.lib /nologo /subsystem:console /machine:I386 /libpath:"../../lib/" !ELSEIF "$(CFG)" == "simple - Win32 Debug" @@ -66,8 +66,8 @@ LINK32=link.exe # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x40c /d "_DEBUG" # ADD RSC /l 0x40c /d "_DEBUG" @@ -75,7 +75,7 @@ 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 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 /subsystem:console /debug /machine:I386 /pdbtype:sept +# 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 /nologo /subsystem:console /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.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"../../lib/" !ENDIF @@ -96,5 +96,9 @@ SOURCE=.\ExampleTestCase.h SOURCE=.\Main.cpp # End Source File +# Begin Source File + +SOURCE=.\Makefile.am +# End Source File # End Target # End Project diff --git a/examples/simple/simple_plugin.dsp b/examples/simple/simple_plugin.dsp index 70d79da..711844b 100644 --- a/examples/simple/simple_plugin.dsp +++ b/examples/simple/simple_plugin.dsp @@ -75,8 +75,8 @@ PostBuild_Cmds=..\..\lib\DllPlugInTester_dll.exe $(TargetPath) # 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 "SIMPLE_PLUGIN_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SIMPLE_PLUGIN_EXPORTS" /D "CPPUNIT_DLL" /FD /GZ /c +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SIMPLE_PLUGIN_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SIMPLE_PLUGIN_EXPORTS" /D "CPPUNIT_DLL" /FD /GZ /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 @@ -92,7 +92,7 @@ LINK32=link.exe TargetPath=.\DebugPlugIn\simple_plugind.dll SOURCE="$(InputPath)" PostBuild_Desc=Running tests... -PostBuild_Cmds=..\..\lib\DllPlugInTesterd_dll.exe $(TargetPath) +PostBuild_Cmds=..\..\lib\DllPlugInTesterd_dll.exe -b --xml tests.xml -c $(TargetPath) # End Special Build Tool !ENDIF diff --git a/examples/simple/simple_plugin.opt b/examples/simple/simple_plugin.opt Binary files differnew file mode 100644 index 0000000..40b55e5 --- /dev/null +++ b/examples/simple/simple_plugin.opt diff --git a/include/cppunit/TestListener.h b/include/cppunit/TestListener.h index b75265f..71d591b 100644 --- a/include/cppunit/TestListener.h +++ b/include/cppunit/TestListener.h @@ -121,7 +121,7 @@ public: * You can use this to do some global initialisation. A listener * could also use to output a 'prolog' to the test run. * - * \param suite Test that is going to be run. + * \param test Test that is going to be run. * \param eventManager Event manager used for the test run. */ virtual void startTestRun( Test *test, @@ -132,7 +132,7 @@ public: * TextTestProgressListener use this to emit a line break. You can also use this * to do some global uninitialisation. * - * \param suite Test that was run. + * \param test Test that was run. * \param eventManager Event manager used for the test run. */ virtual void endTestRun( Test *test, diff --git a/include/cppunit/TestPath.h b/include/cppunit/TestPath.h index 02016ef..ddd0102 100644 --- a/include/cppunit/TestPath.h +++ b/include/cppunit/TestPath.h @@ -73,6 +73,11 @@ public: TestPath( Test *searchRoot, const std::string &pathAsString ); + /*! Copy constructor. + * \param other Object to copy. + */ + TestPath( const TestPath &other ); + virtual ~TestPath(); /*! Tests if the path contains at least one test. @@ -153,6 +158,12 @@ public: */ virtual std::string toString() const; + /*! Assignment operator. + * \param other Object to copy. + * \return This object. + */ + TestPath &operator =( const TestPath &other ); + protected: /*! Checks that the specified test index is within valid range. * \param index Zero based index to check. @@ -187,7 +198,7 @@ protected: protected: typedef std::deque<Test *> Tests; - Tests _tests; + Tests m_tests; }; diff --git a/include/cppunit/config/SelectDllLoader.h b/include/cppunit/config/SelectDllLoader.h index 55959e6..23df1f9 100644 --- a/include/cppunit/config/SelectDllLoader.h +++ b/include/cppunit/config/SelectDllLoader.h @@ -69,4 +69,4 @@ #endif // !defined(CPPUNIT_NO_TESTPLUGIN) -#endif // CPPUNIT_CONFIG_SELECTDLLLOADER_H
\ No newline at end of file +#endif // CPPUNIT_CONFIG_SELECTDLLLOADER_H diff --git a/src/DllPlugInTester/CommandLineParser.cpp b/src/DllPlugInTester/CommandLineParser.cpp new file mode 100644 index 0000000..2efff53 --- /dev/null +++ b/src/DllPlugInTester/CommandLineParser.cpp @@ -0,0 +1,316 @@ +#include "CommandLineParser.h" + + +CommandLineParser::CommandLineParser( int argc, + char *argv[] ) + : m_currentIndex( 0 ) + , m_useCompiler( false ) + , m_useXml( false ) + , m_briefProgress( false ) + , m_noProgress( false ) + , m_useText( false ) + , m_useCout( false ) +{ + for ( int index =1; index < argc; ++index ) + { + if ( index > 1 ) + m_line += " "; + m_line += argv[index]; + } +} + + +CommandLineParser::~CommandLineParser() +{ +} + + +void +CommandLineParser::parse() +{ + while ( hasNext() ) + { + getNextOption(); + if ( isOption( "c", "compiler" ) ) + m_useCompiler = true; + else if ( isOption( "x", "xml" ) ) + { + m_useXml = true; + m_xmlFileName = getOptionalParameter(); + } + else if ( isOption( "s", "xsl" ) ) + m_xsl = getParameter(); + else if ( isOption( "e", "encoding" ) ) + m_encoding = getParameter(); + else if ( isOption( "b", "brief-progress" ) ) + m_briefProgress = true; + else if ( isOption( "n", "no-progress" ) ) + m_noProgress = true; + else if ( isOption( "t", "text" ) ) + m_useText = true; + else if ( isOption( "o", "cout" ) ) + m_useCout = true; + else if ( !m_option.empty() ) + fail( "Unknown option" ); + else if ( hasNext() ) + readNonOptionCommands(); + } +} + + +bool +CommandLineParser::isOption( const std::string &shortName, + const std::string &longName ) +{ + return (m_option == "-" + shortName) || + (m_option == "--" + longName); +} + + +bool +CommandLineParser::hasNext() const +{ + return m_currentIndex < m_line.length(); +} + + +std::string +CommandLineParser::getParameter() +{ + if ( startsWith( "\"" ) ) + return getQuotedParameter(); + else + return getUnquotedParameter(); +} + + +std::string +CommandLineParser::getUnquotedParameter() +{ + std::string parameter; + + if ( !hasNext() ) + fail( "missing option parameter" ); + + while ( hasNext() && !isSpace() ) + parameter += next(); + return parameter; +} + + +std::string +CommandLineParser::getQuotedParameter() +{ + std::string parameter; + while ( !startsWith( "\"" ) ) + { + if ( !hasNext() ) + fail( "Unmatched \" in option parameter" ); + + if ( startsWith( "\\" ) ) + { + skipNext(); + if ( !hasNext() ) + fail( "Missing escaped character in option parameter" ); + } + + parameter += next(); + } + return parameter; +} + + +std::string +CommandLineParser::getOptionalParameter() +{ + if ( !hasNext() || startsWith( "-" ) || startsWith( ":" ) ) + return ""; + return getParameter(); +} + + +void +CommandLineParser::getNextOption() +{ + skipSpaces(); + m_option = ""; + if ( startsWith( "-" ) || startsWith( "--" ) ) + { + while ( hasNext() && !isSpace() ) + m_option += next(); + + skipSpaces(); + } +} + + +void +CommandLineParser::readNonOptionCommands() +{ + if ( startsWith( ":" ) ) + { + skipNext(); + m_testPath = getParameter(); + } + else + { + CommandLinePlugInInfo plugIn; + while ( hasNext() && !isSpace() && !startsWith( "=" ) ) + plugIn.m_fileName += next(); + + std::string parameters; + if ( startsWith( "=" ) ) + { + m_option = plugIn.m_fileName; + skipNext(); + parameters = getParameter(); + } + + plugIn.m_parameters.push_back( parameters ); + m_plugIns.push_back( plugIn ); + } +} + + +bool +CommandLineParser::startsWith( const std::string &expected ) const +{ + return m_line.substr( m_currentIndex, expected.length() ) == expected; +} + + +void +CommandLineParser::skipSpaces() +{ + while ( hasNext() && isSpace() ) + skipNext(); +} + + +bool +CommandLineParser::isSpace() const +{ + if ( !hasNext() ) + return true; + + return isSpace( m_line[m_currentIndex] ); +} + + +bool +CommandLineParser::isSpace( unsigned char c ) +{ + return c <= 32; +} + + +char +CommandLineParser::next() +{ + if ( !hasNext() ) + fail( "unexpected error while parsing option" ); + + return m_line[ m_currentIndex++ ]; +} + + +void +CommandLineParser::skipNext( int count ) +{ + m_currentIndex += count; + if ( m_currentIndex > m_line.length() ) + m_currentIndex = m_line.length(); +} + + +void +CommandLineParser::fail( std::string message ) +{ + throw CommandLineParserException( "Error while parsing option: " + m_option+ + "\n" + message ); +} + + + +bool +CommandLineParser::useCompilerOutputter() const +{ + return m_useCompiler; +} + + +bool +CommandLineParser::useXmlOutputter() const +{ + return m_useXml; +} + + +std::string +CommandLineParser::getXmlFileName() const +{ + return m_xmlFileName; +} + + +std::string +CommandLineParser::getXmlStyleSheet() const +{ + return m_xsl; +} + + +std::string +CommandLineParser::getEncoding() const +{ + return m_encoding; +} + + +bool +CommandLineParser::useBriefTestProgress() const +{ + return m_briefProgress; +} + + +bool +CommandLineParser::noTestProgress() const +{ + return m_noProgress; +} + + +bool +CommandLineParser::useTextOutputter() const +{ + return m_useText; +} + + +bool +CommandLineParser::useCoutStream() const +{ + return m_useCout; +} + + +int +CommandLineParser::getPlugInCount() const +{ + return m_plugIns.size(); +} + +CommandLinePlugInInfo +CommandLineParser::getPlugInAt( int index ) const +{ + return m_plugIns.at( index ); +} + + +std::string +CommandLineParser::getTestPath() const +{ + return m_testPath; +} + diff --git a/src/DllPlugInTester/CommandLineParser.h b/src/DllPlugInTester/CommandLineParser.h new file mode 100644 index 0000000..9fd5c5d --- /dev/null +++ b/src/DllPlugInTester/CommandLineParser.h @@ -0,0 +1,121 @@ +#ifndef CPPUNIT_HELPER_COMMANDLINEPARSER_H +#define CPPUNIT_HELPER_COMMANDLINEPARSER_H + +#include <cppunit/Portability.h> +#include <cppunit/plugin/Parameters.h> +#include <string> +#include <stdexcept> +#include <deque> + + +/*! Exception thrown on error while parsing command line. + */ +class CommandLineParserException : public std::runtime_error +{ +public: + CommandLineParserException( std::string message ) + : std::runtime_error( message ) + { + } +}; + + +struct CommandLinePlugInInfo +{ + std::string m_fileName; + CppUnit::Parameters m_parameters; +}; + + +/*! \brief Parses a command line. + +-c --compiler +-x --xml [filename] +-s --xsl stylesheet +-e --encoding encoding +-b --brief-progress +-n --no-progress +-t --text +-o --cout +filename[="options"] +:testpath + + */ +class CommandLineParser +{ +public: + /*! Constructs a CommandLineParser object. + */ + CommandLineParser( int argc, + char *argv[] ); + + /// Destructor. + virtual ~CommandLineParser(); + + /*! Parses the command line. + * \exception CommandLineParserException if an error occurs. + */ + void parse(); + + bool useCompilerOutputter() const; + bool useXmlOutputter() const; + std::string getXmlFileName() const; + std::string getXmlStyleSheet() const; + std::string getEncoding() const; + bool useBriefTestProgress() const; + bool noTestProgress() const; + bool useTextOutputter() const; + bool useCoutStream() const; + std::string getTestPath() const; + int getPlugInCount() const; + CommandLinePlugInInfo getPlugInAt( int index ) const; + +protected: + /// Prevents the use of the copy constructor. + CommandLineParser( const CommandLineParser © ); + + /// Prevents the use of the copy operator. + void operator =( const CommandLineParser © ); + + bool isOption( const std::string &shortName, + const std::string &longName ); + + bool hasNext() const; + bool startsWith( const std::string &expected ) const; + char next(); + void skipNext( int count =1 ); + bool isSpace() const; + + std::string getParameter(); + std::string getQuotedParameter(); + std::string getUnquotedParameter(); + std::string getOptionalParameter(); + void fail( std::string message ); + void getNextOption(); + void skipSpaces(); + static bool isSpace( unsigned char c ); + + void readNonOptionCommands(); + +protected: + std::string m_line; + int m_currentIndex; + std::string m_option; + + bool m_useCompiler; + bool m_useXml; + std::string m_xmlFileName; + std::string m_xsl; + std::string m_encoding; + bool m_briefProgress; + bool m_noProgress; + bool m_useText; + bool m_useCout; + std::string m_testPath; + + typedef std::deque<CommandLinePlugInInfo> PlugIns; + PlugIns m_plugIns; +}; + + +#endif // CPPUNIT_HELPER_COMMANDLINEPARSER_H diff --git a/src/DllPlugInTester/DllPlugInTester.cpp b/src/DllPlugInTester/DllPlugInTester.cpp index d52c552..df55e06 100644 --- a/src/DllPlugInTester/DllPlugInTester.cpp +++ b/src/DllPlugInTester/DllPlugInTester.cpp @@ -4,40 +4,58 @@ #include <cppunit/TestResult.h> #include <cppunit/TestResultCollector.h> #include <cppunit/TestRunner.h> +#include <cppunit/TextOutputter.h> #include <cppunit/TextTestProgressListener.h> +#include <cppunit/XmlOutputter.h> #include <cppunit/extensions/TestFactoryRegistry.h> #include <cppunit/plugin/DynamicLibraryManagerException.h> #include <cppunit/plugin/Parameters.h> #include <cppunit/plugin/PlugInManager.h> #include <cppunit/plugin/TestPlugIn.h> #include <iostream> +#include <fstream> +#include "CommandLineParser.h" /*! Runs the specified tests located in the root suite. - * \param parameters List of string representing the command line arguments. + * \param parser Command line parser. * \return \c true if the run succeed, \c false if a test failed or if a test * path was not resolved. */ bool -runTests( CppUnit::Parameters parameters ) +runTests( const CommandLineParser &parser ) { CppUnit::TestResult controller; CppUnit::TestResultCollector result; controller.addListener( &result ); - CppUnit::TextTestProgressListener progress; -// CppUnit::BriefTestProgressListener progress; - controller.addListener( &progress ); - std::string testPath; + // Set up outputters + std::ostream *stream = &std::cerr; + if ( parser.useCoutStream() ) + stream = &std::cout; + + std::ostream *xmlStream = stream; + if ( !parser.getXmlFileName().empty() ) + xmlStream = new std::ofstream( parser.getXmlFileName().c_str() ); + + CppUnit::XmlOutputter xmlOutputter( &result, *xmlStream, parser.getEncoding() ); + CppUnit::TextOutputter textOutputter( &result, *stream ); + CppUnit::CompilerOutputter compilerOutputter( &result, *stream ); + + // Set up test listeners + CppUnit::BriefTestProgressListener briefListener; + CppUnit::TextTestProgressListener dotListener; + if ( parser.useBriefTestProgress() ) + controller.addListener( &briefListener ); + else if ( !parser.noTestProgress() ) + controller.addListener( &dotListener ); + + // Set up plug-ins CppUnit::PlugInManager plugInManager; - // Loads plug-ins & get test path. - for ( int index =0; index < parameters.size(); ++index ) + for ( int index =0; index < parser.getPlugInCount(); ++index ) { - std::string parameter = parameters[index]; - if ( parameter[0] == ':' ) - testPath = parameter.substr(1); - else - plugInManager.load( parameter ); + CommandLinePlugInInfo plugIn = parser.getPlugInAt( index ); + plugInManager.load( plugIn.m_fileName, plugIn.m_parameters ); } // Registers plug-in specific TestListener (global setUp/tearDown, custom TestListener...) @@ -48,26 +66,36 @@ runTests( CppUnit::Parameters parameters ) runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() ); // Runs the specified test + bool wasSuccessful = false; try { - runner.run( controller ); + runner.run( controller, parser.getTestPath() ); + wasSuccessful = result.wasSuccessful(); } catch ( std::invalid_argument & ) { - std::cerr << "Failed to resolve test path: " << testPath << std::endl; - return false; + std::cerr << "Failed to resolve test path: " + << parser.getTestPath() + << std::endl; } // Removes plug-in specific TestListener (not really needed but...) plugInManager.removeListener( &controller ); - std::cerr << std::endl; + // write using outputters + if ( parser.useCompilerOutputter() ) + compilerOutputter.write(); + + if ( parser.useTextOutputter() ) + textOutputter.write(); + + if ( parser.useXmlOutputter() ) + xmlOutputter.write(); - // Outputs test result - CppUnit::CompilerOutputter outputter( &result, std::cerr ); - outputter.write(); + if ( !parser.getXmlFileName().empty() ) + delete xmlStream; - return result.wasSuccessful(); + return wasSuccessful; } @@ -96,7 +124,8 @@ runTests( CppUnit::Parameters parameters ) * * If all test succeed and no error happen then the application exit with code 0. * If any error occurs (failed to load dll, failed to resolve test paths) or a - * test fail, the application exit with code 1. + * test fail, the application exit with code 1. If the application failed to + * parse the command line, it exits with code 2. */ int main( int argc, @@ -104,6 +133,7 @@ main( int argc, { const int successReturnCode = 0; const int failureReturnCode = 1; + const int badCommadLineReturnCode = 2; // check command line std::string applicationName( argv[0] ); @@ -113,16 +143,25 @@ main( int argc, << applicationName << " dll-filename1 [dll-filename2 ...] [:test-path]..." << std::endl; - return failureReturnCode; + return badCommadLineReturnCode; + } + + CommandLineParser parser( argc, argv ); + try + { + parser.parse(); + } + catch ( CommandLineParserException &e ) + { + std::cerr << "Error while parsing command line: " << e.what() + << std::endl; + return badCommadLineReturnCode; } bool wasSuccessful = false; try { - CppUnit::Parameters parameters; - for ( int index =1; index < argc; ++index ) - parameters.push_back( argv[index] ); - wasSuccessful = runTests( parameters ); + wasSuccessful = runTests( parser ); } catch ( CppUnit::DynamicLibraryManagerException &e ) { diff --git a/src/DllPlugInTester/DllPlugInTester.dsp b/src/DllPlugInTester/DllPlugInTester.dsp index 060a0c9..371681b 100644 --- a/src/DllPlugInTester/DllPlugInTester.dsp +++ b/src/DllPlugInTester/DllPlugInTester.dsp @@ -206,7 +206,19 @@ LINK32=link.exe # Name "DllPlugInTester - Win32 Debug" # Begin Source File +SOURCE=.\CommandLineParser.cpp +# End Source File +# Begin Source File + +SOURCE=.\CommandLineParser.h +# End Source File +# Begin Source File + SOURCE=.\DllPlugInTester.cpp # End Source File +# Begin Source File + +SOURCE=.\Makefile.am +# End Source File # End Target # End Project diff --git a/src/DllPlugInTester/Makefile.am b/src/DllPlugInTester/Makefile.am index 1594e11..1359af5 100644 --- a/src/DllPlugInTester/Makefile.am +++ b/src/DllPlugInTester/Makefile.am @@ -4,8 +4,11 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include bin_PROGRAMS=DllPlugInTester -DllPlugInTester_SOURCES= DllPlugInTester.cpp +DllPlugInTester_SOURCES= DllPlugInTester.cpp \ + CommandLineParser.h \ + CommandLineParser.cpp DllPlugInTester_LDADD= \ $(top_builddir)/src/cppunit/libcppunit.la ld.so +DllPlugInTester_LDFLAGS = -ldl diff --git a/src/cppunit/BeOsDynamicLibraryManager.cpp b/src/cppunit/BeOsDynamicLibraryManager.cpp index fe5db9f..bdf6c7a 100644 --- a/src/cppunit/BeOsDynamicLibraryManager.cpp +++ b/src/cppunit/BeOsDynamicLibraryManager.cpp @@ -20,7 +20,7 @@ DynamicLibraryManager::doLoadLibrary( const std::string &libraryName ) void DynamicLibraryManager::doReleaseLibrary() { - return ::unload_add_on( (image_id)m_libraryHandle ) == B_OK; + ::unload_add_on( (image_id)m_libraryHandle ); } diff --git a/src/cppunit/DynamicLibraryManager.cpp b/src/cppunit/DynamicLibraryManager.cpp index 1c92e3e..00e97f8 100644 --- a/src/cppunit/DynamicLibraryManager.cpp +++ b/src/cppunit/DynamicLibraryManager.cpp @@ -9,6 +9,7 @@ namespace CppUnit DynamicLibraryManager::DynamicLibraryManager( const std::string &libraryFileName ) : m_libraryHandle( NULL ) + , m_libraryName( libraryFileName ) { loadLibrary( libraryFileName ); } diff --git a/src/cppunit/Makefile.am b/src/cppunit/Makefile.am index 44a925f..ecd4887 100644 --- a/src/cppunit/Makefile.am +++ b/src/cppunit/Makefile.am @@ -1,5 +1,5 @@ # -# $Id: Makefile.am,v 1.29 2002-04-18 09:58:57 blep Exp $ +# $Id: Makefile.am,v 1.30 2002-04-20 21:51:33 blep Exp $ # EXTRA_DIST = cppunit.dsp cppunit_dll.dsp DllMain.cpp @@ -48,6 +48,3 @@ libcppunit_la_LDFLAGS= \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ -release $(LT_RELEASE) - - - diff --git a/src/cppunit/TestPath.cpp b/src/cppunit/TestPath.cpp index ecb89fd..00a7b33 100644 --- a/src/cppunit/TestPath.cpp +++ b/src/cppunit/TestPath.cpp @@ -70,11 +70,26 @@ TestPath::TestPath( Test *searchRoot, } +TestPath::TestPath( const TestPath &other ) + : m_tests( other.m_tests ) +{ +} + + TestPath::~TestPath() { } +TestPath & +TestPath::operator =( const TestPath &other ) +{ + if ( &other != this ) + m_tests = other.m_tests; + return *this; +} + + bool TestPath::isValid() const { @@ -85,7 +100,7 @@ TestPath::isValid() const void TestPath::add( Test *test ) { - _tests.push_back( test ); + m_tests.push_back( test ); } @@ -103,7 +118,7 @@ TestPath::insert( Test *test, { if ( index < 0 || index > getTestCount() ) throw std::out_of_range( "TestPath::insert(): index out of range" ); - _tests.insert( _tests.begin() + index, test ); + m_tests.insert( m_tests.begin() + index, test ); } void @@ -128,7 +143,7 @@ void TestPath::removeTest( int index ) { checkIndexValid( index ); - _tests.erase( _tests.begin() + index ); + m_tests.erase( m_tests.begin() + index ); } @@ -143,7 +158,7 @@ TestPath::up() int TestPath::getTestCount() const { - return _tests.size(); + return m_tests.size(); } @@ -151,7 +166,7 @@ Test * TestPath::getTestAt( int index ) const { checkIndexValid( index ); - return _tests[index]; + return m_tests[index]; } diff --git a/src/cppunit/cppunit.dsp b/src/cppunit/cppunit.dsp index 4674718..7215e49 100644 --- a/src/cppunit/cppunit.dsp +++ b/src/cppunit/cppunit.dsp @@ -101,6 +101,10 @@ SOURCE="..\..\INSTALL-WIN32.txt" # End Source File # Begin Source File +SOURCE=..\..\doc\Money.dox +# End Source File +# Begin Source File + SOURCE=..\..\NEWS # End Source File # Begin Source File |
