summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2002-07-14 18:48:32 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2002-07-14 18:48:32 +0000
commit251c1ff8aecaa608ef9e6041c2691d369430bf7b (patch)
tree183795a04e06a8a94a64214afc2a1cc8a12a5486 /src
parent0807889cb53679c5a9e741e8dedc3668ef59729b (diff)
downloadcppunit-251c1ff8aecaa608ef9e6041c2691d369430bf7b.tar.gz
CodingGuideLines.
CodingGuideLines.txt: added. CppUnit's coding guidelines for portability. * include/cppunit/portability/CppUnitStack.h: added. wrapper for std::stack. * include/cppunit/portability/CppUnitSet.h: added. wrapper for std::set. * include/cppunit/ui/text/TestRunner.h: fixed namespace definition for deprecated TestRunner. * include/cppunit/TestAssert.h: * src/cppunit/TestAssert.cpp: removed old deprecated functions that did not use SourceLine. Moved assertEquals() and assertDoubleEquals() into CppUnit namespace. * src/cppunit/TestFactoryRegistry.cpp: use CppUnitMap instead of std::map. * src/DllPlugInTester/CommandLineParser.h: use CppUnitDeque instead std::deque. * examples/cppunittest/*.h: * examples/cppunittest/*.cpp: removed all usage of CppUnitTest namespace. Everything is now in global space. * examples/*/*.h: * examples/*/*.cpp: replaced usage of CppUnit:: with CPPUNIT_NS::. * examples/ClockerPlugIn/ClockerModel.h: use CppUnit STL wrapper instead of STL container.
Diffstat (limited to 'src')
-rw-r--r--src/DllPlugInTester/CommandLineParser.h8
-rw-r--r--src/DllPlugInTester/CommandLineParserTest.cpp3
-rw-r--r--src/DllPlugInTester/CommandLineParserTest.h2
-rw-r--r--src/DllPlugInTester/DllPlugInTester.cpp22
-rw-r--r--src/DllPlugInTester/DllPlugInTesterTest.cpp6
-rw-r--r--src/cppunit/TestAssert.cpp55
-rw-r--r--src/cppunit/TestFactoryRegistry.cpp4
-rw-r--r--src/cppunit/cppunit.dsp12
-rw-r--r--src/cppunit/cppunit_dll.dsp32
9 files changed, 70 insertions, 74 deletions
diff --git a/src/DllPlugInTester/CommandLineParser.h b/src/DllPlugInTester/CommandLineParser.h
index 88a625c..d08092c 100644
--- a/src/DllPlugInTester/CommandLineParser.h
+++ b/src/DllPlugInTester/CommandLineParser.h
@@ -2,10 +2,10 @@
#define CPPUNIT_HELPER_COMMANDLINEPARSER_H
#include <cppunit/Portability.h>
+#include <cppunit/portability/CppUnitDeque.h>
#include <cppunit/plugin/Parameters.h>
#include <string>
#include <stdexcept>
-#include <deque>
/*! Exception thrown on error while parsing command line.
@@ -23,7 +23,7 @@ public:
struct CommandLinePlugInInfo
{
std::string m_fileName;
- CppUnit::Parameters m_parameters;
+ CPPUNIT_NS::Parameters m_parameters;
};
@@ -113,10 +113,10 @@ protected:
bool m_waitBeforeExit;
std::string m_testPath;
- typedef std::deque<CommandLinePlugInInfo> PlugIns;
+ typedef CppUnitDeque<CommandLinePlugInInfo> PlugIns;
PlugIns m_plugIns;
- typedef std::deque<std::string> Arguments;
+ typedef CppUnitDeque<std::string> Arguments;
Arguments m_arguments;
int m_currentArgument;
diff --git a/src/DllPlugInTester/CommandLineParserTest.cpp b/src/DllPlugInTester/CommandLineParserTest.cpp
index 8f2f2bf..34bc67d 100644
--- a/src/DllPlugInTester/CommandLineParserTest.cpp
+++ b/src/DllPlugInTester/CommandLineParserTest.cpp
@@ -4,8 +4,7 @@
CPPUNIT_TEST_SUITE_REGISTRATION( CommandLineParserTest );
-CommandLineParserTest::CommandLineParserTest() :
- CppUnit::TestCase()
+CommandLineParserTest::CommandLineParserTest()
{
}
diff --git a/src/DllPlugInTester/CommandLineParserTest.h b/src/DllPlugInTester/CommandLineParserTest.h
index 3e31709..fa15fb1 100644
--- a/src/DllPlugInTester/CommandLineParserTest.h
+++ b/src/DllPlugInTester/CommandLineParserTest.h
@@ -8,7 +8,7 @@ class CommandLineParser;
class CommandLineParserException;
-class CommandLineParserTest : public CppUnit::TestCase
+class CommandLineParserTest : public CPPUNIT_NS::TestCase
{
CPPUNIT_TEST_SUITE( CommandLineParserTest );
CPPUNIT_TEST( testEmptyCommandLine );
diff --git a/src/DllPlugInTester/DllPlugInTester.cpp b/src/DllPlugInTester/DllPlugInTester.cpp
index 3bbb797..21dea9f 100644
--- a/src/DllPlugInTester/DllPlugInTester.cpp
+++ b/src/DllPlugInTester/DllPlugInTester.cpp
@@ -33,13 +33,13 @@ bool
runTests( const CommandLineParser &parser )
{
bool wasSuccessful = false;
- CppUnit::PlugInManager plugInManager;
+ CPPUNIT_NS::PlugInManager plugInManager;
// The following scope is used to explicitely free all memory allocated before
// unload the test plug-ins (uppon plugInManager destruction).
{
- CppUnit::TestResult controller;
- CppUnit::TestResultCollector result;
+ CPPUNIT_NS::TestResult controller;
+ CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// Set up outputters
@@ -51,14 +51,14 @@ runTests( const CommandLineParser &parser )
if ( !parser.getXmlFileName().empty() )
xmlStream = new std::ofstream( parser.getXmlFileName().c_str() );
- CppUnit::XmlOutputter xmlOutputter( &result, *xmlStream, parser.getEncoding() );
+ CPPUNIT_NS::XmlOutputter xmlOutputter( &result, *xmlStream, parser.getEncoding() );
xmlOutputter.setStyleSheet( parser.getXmlStyleSheet() );
- CppUnit::TextOutputter textOutputter( &result, *stream );
- CppUnit::CompilerOutputter compilerOutputter( &result, *stream );
+ CPPUNIT_NS::TextOutputter textOutputter( &result, *stream );
+ CPPUNIT_NS::CompilerOutputter compilerOutputter( &result, *stream );
// Set up test listeners
- CppUnit::BriefTestProgressListener briefListener;
- CppUnit::TextTestProgressListener dotListener;
+ CPPUNIT_NS::BriefTestProgressListener briefListener;
+ CPPUNIT_NS::TextTestProgressListener dotListener;
if ( parser.useBriefTestProgress() )
controller.addListener( &briefListener );
else if ( !parser.noTestProgress() )
@@ -75,8 +75,8 @@ runTests( const CommandLineParser &parser )
plugInManager.addListener( &controller );
// Adds the default registry suite
- CppUnit::TestRunner runner;
- runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() );
+ CPPUNIT_NS::TestRunner runner;
+ runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
// Runs the specified test
try
@@ -240,7 +240,7 @@ main( int argc,
{
wasSuccessful = runTests( parser );
}
- catch ( CppUnit::DynamicLibraryManagerException &e )
+ catch ( CPPUNIT_NS::DynamicLibraryManagerException &e )
{
std::cerr << "Failed to load test plug-in:" << std::endl
<< e.what() << std::endl;
diff --git a/src/DllPlugInTester/DllPlugInTesterTest.cpp b/src/DllPlugInTester/DllPlugInTesterTest.cpp
index e85d02b..02488f1 100644
--- a/src/DllPlugInTester/DllPlugInTesterTest.cpp
+++ b/src/DllPlugInTester/DllPlugInTesterTest.cpp
@@ -5,10 +5,10 @@
int main(int argc, char* argv[])
{
- CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
- CppUnit::TextUi::TestRunner runner;
+ CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
+ CPPUNIT_NS::TextUi::TestRunner runner;
runner.addTest( suite );
- runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
+ runner.setOutputter( new CPPUNIT_NS::CompilerOutputter( &runner.result(),
std::cerr ) );
bool wasSucessful = runner.run();
return wasSucessful ? 0 : 1;
diff --git a/src/cppunit/TestAssert.cpp b/src/cppunit/TestAssert.cpp
index 8d9ad80..484f372 100644
--- a/src/cppunit/TestAssert.cpp
+++ b/src/cppunit/TestAssert.cpp
@@ -10,55 +10,11 @@
CPPUNIT_NS_BEGIN
-#ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED
-/// Check for a failed general assertion
void
-TestAssert::assertImplementation( bool condition,
- std::string conditionExpression,
- long lineNumber,
- std::string fileName )
-{
- Asserter::failIf( condition,
- conditionExpression,
- SourceLine( fileName, lineNumber ) );
-}
-
-
-/// Reports failed equality
-void
-TestAssert::assertNotEqualImplementation( std::string expected,
- std::string actual,
- long lineNumber,
- std::string fileName )
-{
- Asserter::failNotEqual( expected,
- actual,
- SouceLine( fileName, lineNumber ), "" );
-}
-
-
-/// Check for a failed equality assertion
-void
-TestAssert::assertEquals( double expected,
- double actual,
- double delta,
- long lineNumber,
- std::string fileName )
-{
- if (fabs (expected - actual) > delta)
- assertNotEqualImplementation( assertion_traits<double>::toString(expected),
- assertion_traits<double>::toString(actual),
- lineNumber,
- fileName );
-}
-
-#else // CPPUNIT_ENABLE_SOURCELINE_DEPRECATED
-
-void
-TestAssert::assertDoubleEquals( double expected,
- double actual,
- double delta,
- SourceLine sourceLine )
+assertDoubleEquals( double expected,
+ double actual,
+ double delta,
+ SourceLine sourceLine )
{
Asserter::failNotEqualIf( fabs( expected - actual ) > delta,
assertion_traits<double>::toString(expected),
@@ -67,7 +23,4 @@ TestAssert::assertDoubleEquals( double expected,
}
-#endif
-
-
CPPUNIT_NS_END
diff --git a/src/cppunit/TestFactoryRegistry.cpp b/src/cppunit/TestFactoryRegistry.cpp
index 095caa6..663237a 100644
--- a/src/cppunit/TestFactoryRegistry.cpp
+++ b/src/cppunit/TestFactoryRegistry.cpp
@@ -1,6 +1,6 @@
#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/portability/CppUnitMap.h>
#include <cppunit/TestSuite.h>
-#include <map>
#include <assert.h>
@@ -11,7 +11,7 @@ CPPUNIT_NS_BEGIN
class TestFactoryRegistryList
{
private:
- typedef std::map<std::string, TestFactoryRegistry *> Registries;
+ typedef CppUnitMap<std::string, TestFactoryRegistry *> Registries;
Registries m_registries;
enum State {
diff --git a/src/cppunit/cppunit.dsp b/src/cppunit/cppunit.dsp
index 76564e1..e0bd8c6 100644
--- a/src/cppunit/cppunit.dsp
+++ b/src/cppunit/cppunit.dsp
@@ -103,6 +103,10 @@ SOURCE=..\..\ChangeLog
# End Source File
# Begin Source File
+SOURCE=..\..\CodingGuideLines.txt
+# End Source File
+# Begin Source File
+
SOURCE=..\..\doc\cookbook.dox
# End Source File
# Begin Source File
@@ -223,6 +227,14 @@ SOURCE=..\..\include\cppunit\portability\CppUnitMap.h
# End Source File
# Begin Source File
+SOURCE=..\..\include\cppunit\portability\CppUnitSet.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\cppunit\portability\CppUnitStack.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\include\cppunit\portability\CppUnitVector.h
# End Source File
# Begin Source File
diff --git a/src/cppunit/cppunit_dll.dsp b/src/cppunit/cppunit_dll.dsp
index acef366..71e720f 100644
--- a/src/cppunit/cppunit_dll.dsp
+++ b/src/cppunit/cppunit_dll.dsp
@@ -399,6 +399,30 @@ SOURCE="..\..\include\cppunit\config\config-msvc6.h"
# End Source File
# Begin Source File
+SOURCE=..\..\include\cppunit\config\CppUnitApi.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\cppunit\portability\CppUnitDeque.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\cppunit\portability\CppUnitMap.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\cppunit\portability\CppUnitSet.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\cppunit\portability\CppUnitStack.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\cppunit\portability\CppUnitVector.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\include\cppunit\Portability.h
# End Source File
# Begin Source File
@@ -411,12 +435,20 @@ SOURCE=..\..\include\cppunit\config\SelectDllLoader.h
# PROP Default_Filter ""
# Begin Source File
+SOURCE=..\..\include\cppunit\ui\text\TestRunner.h
+# End Source File
+# Begin Source File
+
SOURCE=.\TextTestRunner.cpp
# End Source File
# Begin Source File
SOURCE=..\..\include\cppunit\TextTestRunner.h
# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\cppunit\ui\text\TextTestRunner.h
+# End Source File
# End Group
# Begin Group "listener"