summaryrefslogtreecommitdiff
path: root/src/cppunit
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2002-03-28 14:50:09 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2002-03-28 14:50:09 +0000
commit82d51cba4c7cc8d756ab14fdfc28181f007f3848 (patch)
treed28a09b421cb1802e5720cd112a577958b2c9d0f /src/cppunit
parent686e4865001cb14c36e8e3e81fc7c57786ff0542 (diff)
downloadcppunit-82d51cba4c7cc8d756ab14fdfc28181f007f3848.tar.gz
Doc/cookbook.
doc/cookbook.html: removed. Replaced by cookbook.doc. * doc/cookbook.dox: added, conversion of cookbook.html to Doxygen format. * doc/other_documentation.dox: added groups definition. * doc/Makefile.am: replaced cookbook.html by cookbook.dox * doc/Doxyfile.in: added predefined CPPUNIT_HAVE_CPP_SOURCE_ANNOTATION. Replaced cookbook.html by cookbook.dox. * include/cppunitui/mfc/TestRunner.h: added, extracted from include/msvc6/testrunner/TestRunner.h. Moved class TestRunner to namespace CppUnit::MfcUi. * include/msvc6/testrunner/TestRunner.h: deprecated. A simple typedef to CppUnit::MfcUi::TestRunner. * include/textui/TestRuner.h: added, extracted from include/cppunit/TextTestRunner.h. * src/cppunit/TextTestRunner.cpp: renamed TestRunner.cpp. Moved into namespace CppUnit::TextUi. * src/msvc6/testruner/TestRunner.cpp: moved into namespace CppUnit::MfcUi. * src/cppunit/CompilerOutputter.cpp: removed printing "- " before NotEqualException addional message, for consistency between different TestRunner (Mfc,Text...) * include/cppunit/Asserter.h: * include/cppunit/CompilerOutputter.h: * include/cppunit/Exception.h: * include/cppunit/NotEqualException.h: * include/cppunit/Outputter.h: * include/cppunit/SourceLine.h: * include/cppunit/TestAssert.h: * include/cppunit/TestCaller.h: * include/cppunit/TestFailure.h: * include/cppunit/TestFixture.h: * include/cppunit/TestListener.h: * include/cppunit/TestResult.h: * include/cppunit/TestResultCollector.h: * include/cppunit/TestSucessListener.h: * include/cppunit/TestSuite.h: * include/cppunit/TextTestProgressListener.h: * include/cppunit/TextTestRunner.h: * include/cppunit/XmlOutputter.h: * include/cppunit/extensions/AutoRegisterSuite.h: * include/cppunit/extensions/HelperMacros.h: * include/cppunit/extensions/TestFactoryRegistry.h: * include/cppunit/extensions/TestSuiteBuilder.h: * include/cppunit/extensions/TestSuiteFactory.h: doc update. organization in groups. * examples/msvc6/CppUnitTestApp/CppUnitTestApp.cpp: * examples/msvc6/HostApp/HostApp.cpp: updated to use CppUnit::MfcUi::TestRunner. * examples/cppunittest/CppUnitTestMain.cpp: updated to use CppUnit::TextUi::TestRunner.
Diffstat (limited to 'src/cppunit')
-rw-r--r--src/cppunit/CompilerOutputter.cpp27
-rw-r--r--src/cppunit/Makefile.am4
-rw-r--r--src/cppunit/Outputter.cpp21
-rw-r--r--src/cppunit/TestFactoryRegistry.cpp2
-rw-r--r--src/cppunit/TestRunner.cpp (renamed from src/cppunit/TextTestRunner.cpp)57
-rw-r--r--src/cppunit/cppunit.dsp70
-rw-r--r--src/cppunit/cppunit_dll.dsp22
7 files changed, 99 insertions, 104 deletions
diff --git a/src/cppunit/CompilerOutputter.cpp b/src/cppunit/CompilerOutputter.cpp
index 54c881a..025dd34 100644
--- a/src/cppunit/CompilerOutputter.cpp
+++ b/src/cppunit/CompilerOutputter.cpp
@@ -9,31 +9,6 @@
namespace CppUnit
{
-/** Print TestResult in a compiler compatible format.
- *
- * Note: NEED UPDATE
- *
- * Heres is an example of usage:
- * \code
- * int main( int argc, char* argv[] ) {
- * bool selfTest = (argc > 1) &&
- * (std::string("-selftest") == argv[1]);
- *
- * CppUnit::TextTestRunner runner;
- * runner.addTest( CppUnitTest::suite() );
- *
- * bool wasSucessful = runner.run( "", false, !selfTest );
- * if ( selfTest )
- * {
- * CppUnit::CompilerOutputter outputter( runner.result(),
- * std::cerr );
- * outputter.write();
- * }
- *
- * return wasSucessful ? 0 : 1;
- * }
- * \endcode
- */
CompilerOutputter::CompilerOutputter( TestResultCollector *result,
std::ostream &stream ) :
m_result( result ),
@@ -152,7 +127,7 @@ CompilerOutputter::printNotEqualMessage( Exception *thrownException )
m_stream << std::endl;
if ( !e->additionalMessage().empty() )
{
- m_stream << wrap( "- " + e->additionalMessage() );
+ m_stream << wrap( e->additionalMessage() );
m_stream << std::endl;
}
}
diff --git a/src/cppunit/Makefile.am b/src/cppunit/Makefile.am
index a8112d1..8b239de 100644
--- a/src/cppunit/Makefile.am
+++ b/src/cppunit/Makefile.am
@@ -1,5 +1,5 @@
#
-# $Id: Makefile.am,v 1.18 2002-03-25 22:35:34 blep Exp $
+# $Id: Makefile.am,v 1.19 2002-03-28 15:47:08 blep Exp $
#
EXTRA_DIST = cppunit.dsw cppunit.dsp cppunit_dll.dsp DllMain.cpp
@@ -21,13 +21,13 @@ libcppunit_la_SOURCES = \
TestFailure.cpp \
TestResult.cpp \
TestResultCollector.cpp \
+ TestRunner.cpp \
TestSetUp.cpp \
TestSucessListener.cpp \
TestSuite.cpp \
TextOutputter.cpp \
TextTestProgressListener.cpp \
TextTestResult.cpp \
- TextTestRunner.cpp \
TypeInfoHelper.cpp \
XmlOutputter.cpp
diff --git a/src/cppunit/Outputter.cpp b/src/cppunit/Outputter.cpp
deleted file mode 100644
index c011b1d..0000000
--- a/src/cppunit/Outputter.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <cppunit/Outputter.h>
-
-
-namespace CppUnit
-{
-
-
-
-
-Outputter::Outputter()
-{
-}
-
-
-Outputter::~Outputter()
-{
-}
-
-
-} // namespace CppUnit
-
diff --git a/src/cppunit/TestFactoryRegistry.cpp b/src/cppunit/TestFactoryRegistry.cpp
index 5082736..d46ff29 100644
--- a/src/cppunit/TestFactoryRegistry.cpp
+++ b/src/cppunit/TestFactoryRegistry.cpp
@@ -10,7 +10,7 @@
namespace CppUnit {
-/** This class manages all the TestFactoryRegistry.
+/** (Implementation) This class manages all the TestFactoryRegistry.
*
* Responsible for the life-cycle of the TestFactoryRegistry.
*
diff --git a/src/cppunit/TextTestRunner.cpp b/src/cppunit/TestRunner.cpp
index e17abe9..6c1a110 100644
--- a/src/cppunit/TextTestRunner.cpp
+++ b/src/cppunit/TestRunner.cpp
@@ -1,17 +1,19 @@
#include <cppunit/TestSuite.h>
-#include <cppunit/TextTestRunner.h>
#include <cppunit/TextTestResult.h>
#include <cppunit/TextOutputter.h>
#include <cppunit/TextTestProgressListener.h>
#include <cppunit/TestResult.h>
+#include <cppunitui/text/TestRunner.h>
#include <iostream>
+
namespace CppUnit {
+namespace TextUi {
/*! Constructs a new text runner.
* \param outputter used to print text result. Owned by the runner.
*/
-TextTestRunner::TextTestRunner( Outputter *outputter )
+TestRunner::TestRunner( Outputter *outputter )
: m_outputter( outputter )
, m_suite( new TestSuite( "All Tests" ) )
, m_result( new TestResultCollector() )
@@ -23,7 +25,7 @@ TextTestRunner::TextTestRunner( Outputter *outputter )
}
-TextTestRunner::~TextTestRunner()
+TestRunner::~TestRunner()
{
delete m_eventManager;
delete m_outputter;
@@ -37,7 +39,7 @@ TextTestRunner::~TextTestRunner()
* \param test Test to add.
*/
void
-TextTestRunner::addTest( Test *test )
+TestRunner::addTest( Test *test )
{
if ( test != NULL )
m_suite->addTest( test );
@@ -49,22 +51,22 @@ TextTestRunner::addTest( Test *test )
* \param testName Name of the test case to run. If an empty is given, then
* all added test are run. The name must be the name of
* of an added test.
- * \param wait if \c true then the user must press the RETURN key
+ * \param doWait if \c true then the user must press the RETURN key
* before the run() method exit.
- * \param printResult if \c true (default) then the test result are printed
- * on the standard output.
- * \param printProgress if \c true (default) then TextTestProgressListener is
- * used to show the progress.
+ * \param doPrintResult if \c true (default) then the test result are printed
+ * on the standard output.
+ * \param doPrintProgress if \c true (default) then TextTestProgressListener is
+ * used to show the progress.
* \return \c true is the test was successful, \c false if the test
* failed or was not found.
*/
bool
-TextTestRunner::run( std::string testName,
+TestRunner::run( std::string testName,
bool doWait,
bool doPrintResult,
- bool printProgress )
+ bool doPrintProgress )
{
- runTestByName( testName, printProgress );
+ runTestByName( testName, doPrintProgress );
printResult( doPrintResult );
wait( doWait );
return m_result->wasSuccessful();
@@ -72,15 +74,15 @@ TextTestRunner::run( std::string testName,
bool
-TextTestRunner::runTestByName( std::string testName,
- bool printProgress )
+TestRunner::runTestByName( std::string testName,
+ bool doPrintProgress )
{
if ( testName.empty() )
- return runTest( m_suite, printProgress );
+ return runTest( m_suite, doPrintProgress );
Test *test = findTestByName( testName );
if ( test != NULL )
- return runTest( test, printProgress );
+ return runTest( test, doPrintProgress );
std::cout << "Test " << testName << " not found." << std::endl;
return false;
@@ -88,7 +90,7 @@ TextTestRunner::runTestByName( std::string testName,
void
-TextTestRunner::wait( bool doWait )
+TestRunner::wait( bool doWait )
{
if ( doWait )
{
@@ -99,7 +101,7 @@ TextTestRunner::wait( bool doWait )
void
-TextTestRunner::printResult( bool doPrintResult )
+TestRunner::printResult( bool doPrintResult )
{
std::cout << std::endl;
if ( doPrintResult )
@@ -108,7 +110,7 @@ TextTestRunner::printResult( bool doPrintResult )
Test *
-TextTestRunner::findTestByName( std::string name ) const
+TestRunner::findTestByName( std::string name ) const
{
for ( std::vector<Test *>::const_iterator it = m_suite->getTests().begin();
it != m_suite->getTests().end();
@@ -123,14 +125,16 @@ TextTestRunner::findTestByName( std::string name ) const
bool
-TextTestRunner::runTest( Test *test,
- bool printTextProgress )
+TestRunner::runTest( Test *test,
+ bool doPrintProgress )
{
TextTestProgressListener progress;
- if ( printTextProgress )
+ if ( doPrintProgress )
m_eventManager->addListener( &progress );
+
test->run( m_eventManager );
- if ( printTextProgress )
+
+ if ( doPrintProgress )
m_eventManager->removeListener( &progress );
return m_result->wasSuccessful();
}
@@ -140,7 +144,7 @@ TextTestRunner::runTest( Test *test,
* Use this after calling run() to access the result of the test run.
*/
TestResultCollector &
-TextTestRunner::result() const
+TestRunner::result() const
{
return *m_result;
}
@@ -151,7 +155,7 @@ TextTestRunner::result() const
* test. Use this to register additional TestListener before running the tests.
*/
TestResult &
-TextTestRunner::eventManager() const
+TestRunner::eventManager() const
{
return *m_eventManager;
}
@@ -164,11 +168,12 @@ TextTestRunner::eventManager() const
* \see CompilerOutputter, XmlOutputter, TextOutputter.
*/
void
-TextTestRunner::setOutputter( Outputter *outputter )
+TestRunner::setOutputter( Outputter *outputter )
{
delete m_outputter;
m_outputter = outputter;
}
+} // namespace TextUi
} // namespace CppUnit
diff --git a/src/cppunit/cppunit.dsp b/src/cppunit/cppunit.dsp
index 3110428..f0e9612 100644
--- a/src/cppunit/cppunit.dsp
+++ b/src/cppunit/cppunit.dsp
@@ -299,84 +299,112 @@ SOURCE=..\..\include\cppunit\TestResultCollector.h
# End Source File
# Begin Source File
-SOURCE=.\TestSucessListener.cpp
+SOURCE=.\TextOutputter.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\include\cppunit\TestSucessListener.h
+SOURCE=..\..\include\cppunit\TextOutputter.h
# End Source File
# Begin Source File
-SOURCE=.\TextOutputter.cpp
+SOURCE=.\XmlOutputter.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\include\cppunit\TextOutputter.h
+SOURCE=..\..\include\cppunit\XmlOutputter.h
# End Source File
+# End Group
+# Begin Group "portability"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=.\TextTestProgressListener.cpp
+SOURCE="..\..\include\cppunit\config-msvc6.h"
# End Source File
# Begin Source File
-SOURCE=..\..\include\cppunit\TextTestProgressListener.h
+SOURCE=..\..\include\cppunit\Portability.h
# End Source File
+# End Group
+# Begin Group "textui"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=.\TextTestResult.cpp
+SOURCE=.\TestRunner.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\include\cppunit\TextTestResult.h
+SOURCE=..\..\include\cppunitui\text\TestRunner.h
# End Source File
# Begin Source File
-SOURCE=.\TextTestRunner.cpp
+SOURCE=..\..\include\cppunit\TextTestRunner.h
# End Source File
+# End Group
+# Begin Group "listener"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\include\cppunit\TextTestRunner.h
+SOURCE=.\TestSucessListener.cpp
# End Source File
# Begin Source File
-SOURCE=.\XmlOutputter.cpp
+SOURCE=..\..\include\cppunit\TestSucessListener.h
# End Source File
# Begin Source File
-SOURCE=..\..\include\cppunit\XmlOutputter.h
+SOURCE=.\TextTestProgressListener.cpp
# End Source File
-# End Group
-# Begin Group "portability"
+# Begin Source File
-# PROP Default_Filter ""
+SOURCE=..\..\include\cppunit\TextTestProgressListener.h
+# End Source File
# Begin Source File
-SOURCE="..\..\include\cppunit\config-msvc6.h"
+SOURCE=.\TextTestResult.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\include\cppunit\Portability.h
+SOURCE=..\..\include\cppunit\TextTestResult.h
# End Source File
# End Group
+# Begin Group "documentation"
+
+# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\ChangeLog
# End Source File
# Begin Source File
-SOURCE="..\..\INSTALL-WIN32.txt"
+SOURCE=..\..\doc\cookbook.dox
# End Source File
# Begin Source File
-SOURCE=..\..\include\cppunit\Makefile.am
+SOURCE=..\..\doc\FAQ
# End Source File
# Begin Source File
-SOURCE=.\Makefile.am
+SOURCE=..\..\NEWS
# End Source File
# Begin Source File
-SOURCE=..\..\NEWS
+SOURCE=..\..\doc\other_documentation.dox
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE="..\..\INSTALL-WIN32.txt"
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\cppunit\Makefile.am
+# End Source File
+# Begin Source File
+
+SOURCE=.\Makefile.am
# End Source File
# End Target
# End Project
diff --git a/src/cppunit/cppunit_dll.dsp b/src/cppunit/cppunit_dll.dsp
index 3bbccc7..4e4f8d1 100644
--- a/src/cppunit/cppunit_dll.dsp
+++ b/src/cppunit/cppunit_dll.dsp
@@ -314,31 +314,39 @@ SOURCE=..\..\include\cppunit\TextTestResult.h
# End Source File
# Begin Source File
-SOURCE=.\TextTestRunner.cpp
+SOURCE=.\XmlOutputter.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\include\cppunit\TextTestRunner.h
+SOURCE=..\..\include\cppunit\XmlOutputter.h
# End Source File
+# End Group
+# Begin Group "portability"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=.\XmlOutputter.cpp
+SOURCE="..\..\include\cppunit\config-msvc6.h"
# End Source File
# Begin Source File
-SOURCE=..\..\include\cppunit\XmlOutputter.h
+SOURCE=..\..\include\cppunit\Portability.h
# End Source File
# End Group
-# Begin Group "portability"
+# Begin Group "textui"
# PROP Default_Filter ""
# Begin Source File
-SOURCE="..\..\include\cppunit\config-msvc6.h"
+SOURCE=.\TestRunner.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\include\cppunit\Portability.h
+SOURCE=..\..\include\cppunitui\text\TestRunner.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\cppunit\TextTestRunner.h
# End Source File
# End Group
# Begin Source File