diff options
121 files changed, 1278 insertions, 1031 deletions
@@ -1,3 +1,58 @@ +2002-07-13 Baptiste Lepilleur <gaiacrtn@free.fr> + + * include/cppunit/ui/text/TestRunner.h: + * src/cppunit/TextTestRunner.cpp: Renamed TextUi::TestRunner + TextTestRunner and moved it to the CppUnit namespace. Added + a deprecated typedef for compatibility with previous version. + + * include/cppunit/ui/text/TextTestRunner.h: added. + + * include/cppunit/ui/mfc/TestRunner.h: + * src/cppunit/msvc6/testrunner/TestRunner.cpp: Renamed MfcUi::TestRunner + MfcTestRunner. Added deprecated typedef for compatibility. Renamed + TestRunner.cpp to MfcTestRunner.cpp. + + * include/cppunit/ui/mfc/MfcTestRunner.h: added. + + * include/cppunit/ui/qt/TestRunner.h: + * src/qttestrunner/TestRunner.cpp: renamed QtUi::TestRunner QtTestRunner + and moved it to CppUnit namespace. Added a deprecated typedef for + compatibility. Renamed TestRunner.cpp to QtTestRunner.cpp. + + * include/cppunit/ui/qt/TestRunner.h: + * src/qttestrunner/TestRunner.h: Moved TestRunner to CppUnit namespace + and renamed it QtTestRunner. Added deprecated typedef for compatibility. + + * include/cppunit/Asserter.h: + * src/cppunit/Asserter.cpp: changed namespace Asserter to a struct and + made all methods static. + + * include/cppunit/extensions/HelperMacros.h: + * include/cppunit/extensions/SourceLine.h: + * include/cppunit/extensions/TestAssert.h: + * include/cppunit/extensions/TestPlugIn.h: + * include/cppunit/Portability.h: changed CPPUNIT_NS(symbol) to a + symbol macro that expand either to CppUnit or nothing. The symbol is + no longer a parameter. + + * include/cppunit/portability/CppUnitVector.h: + * include/cppunit/portability/CppUnitDeque.h: + * include/cppunit/portability/CppUnitMap.h: added. STL Wrapper for + compilers that do not support template default argumenent and need + the allocator to be passed when instantiating STL container. + + * examples/cppunittest/*.h: + * examples/cppunittest/*.cpp: + * src/msvc6/testrunner/*.h: + * src/msvc6/testrunner/*.cpp: + * src/msvc6/testpluginrunner/*.h: + * src/msvc6/testpluginrunner/*.cpp: + * src/qttestrunner/*.h: + * src/qttestrunner/*.cpp: replaced occurence of CppUnit:: by CPPUNIT_NS. + + * src/cppunit/TestSuite.h: + replaced occurence of std::vector by CppUnitVector. + 2002-07-12 Baptiste Lepilleur <gaiacrtn@free.fr> * include/cppunit/config/Portability.h: If the compiler does not support diff --git a/doc/CppUnit-win.dox b/doc/CppUnit-win.dox index 788f552..6b2e592 100644 --- a/doc/CppUnit-win.dox +++ b/doc/CppUnit-win.dox @@ -759,7 +759,8 @@ INCLUDE_FILE_PATTERNS = PREDEFINED = CPPUNIT_HAVE_CPP_SOURCE_ANNOTATION \ CPPUNIT_HAVE_NAMESPACES=1 \ CPPUNIT_NS_BEGIN="namespace CppUnit {" \ - CPPUNIT_NS_END=} + CPPUNIT_NS_END=} \ + CPPUNIT_NS=CppUnit # If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index 68b9322..28f4624 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -484,7 +484,8 @@ INCLUDE_PATH = PREDEFINED = CPPUNIT_HAVE_CPP_SOURCE_ANNOTATION \ CPPUNIT_HAVE_NAMESPACES=1 \ CPPUNIT_NS_BEGIN="namespace CppUnit {" \ - CPPUNIT_NS_END=} + CPPUNIT_NS_END=} \ + CPPUNIT_NS=CppUnit # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the diff --git a/examples/cppunittest/BaseTestCase.h b/examples/cppunittest/BaseTestCase.h index 86f069f..019ed66 100644 --- a/examples/cppunittest/BaseTestCase.h +++ b/examples/cppunittest/BaseTestCase.h @@ -4,7 +4,7 @@ #include <cppunit/extensions/HelperMacros.h> -class BaseTestCase : public CppUnit::TestCase +class BaseTestCase : public CPPUNIT_NS::TestCase { CPPUNIT_TEST_SUITE( BaseTestCase ); CPPUNIT_TEST( testUsingCheckIt ); diff --git a/examples/cppunittest/CppUnitTestMain.cpp b/examples/cppunittest/CppUnitTestMain.cpp index 1e00009..ab626b2 100644 --- a/examples/cppunittest/CppUnitTestMain.cpp +++ b/examples/cppunittest/CppUnitTestMain.cpp @@ -18,23 +18,23 @@ main( int argc, char* argv[] ) std::string testPath = (argc > 1) ? std::string(argv[1]) : ""; // Create the event manager and test controller - CppUnit::TestResult controller; + CPPUNIT_NS::TestResult controller; // Add a listener that colllects test result - CppUnit::TestResultCollector result; + CPPUNIT_NS::TestResultCollector result; controller.addListener( &result ); // Add a listener that print dots as test run. #ifdef WIN32 - CppUnit::TextTestProgressListener progress; + CPPUNIT_NS::TextTestProgressListener progress; #else - CppUnit::BriefTestProgressListener progress; + CPPUNIT_NS::BriefTestProgressListener progress; #endif controller.addListener( &progress ); // Add the top suite to the test runner - CppUnit::TestRunner runner; - runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() ); + CPPUNIT_NS::TestRunner runner; + runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() ); try { std::cout << "Running " << testPath; @@ -43,11 +43,11 @@ main( int argc, char* argv[] ) std::cerr << std::endl; // Print test in a compiler compatible format. - CppUnit::CompilerOutputter outputter( &result, std::cerr ); + CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr ); outputter.write(); std::ofstream file( "tests.xml" ); - CppUnit::XmlOutputter xml( &result, file ); + CPPUNIT_NS::XmlOutputter xml( &result, file ); xml.setStyleSheet( "report.xsl" ); xml.write(); file.close(); diff --git a/examples/cppunittest/ExceptionTest.cpp b/examples/cppunittest/ExceptionTest.cpp index c3d1876..c703c7d 100644 --- a/examples/cppunittest/ExceptionTest.cpp +++ b/examples/cppunittest/ExceptionTest.cpp @@ -33,10 +33,10 @@ ExceptionTest::tearDown() void ExceptionTest::testConstructor() { - const CppUnit::Message message( "a message" ); - const CppUnit::SourceLine sourceLine( "dir/afile.cpp", 17 ); + const CPPUNIT_NS::Message message( "a message" ); + const CPPUNIT_NS::SourceLine sourceLine( "dir/afile.cpp", 17 ); - CppUnit::Exception e( message, sourceLine ); + CPPUNIT_NS::Exception e( message, sourceLine ); CPPUNIT_ASSERT_EQUAL( message.shortDescription(), e.message().shortDescription() ); CPPUNIT_ASSERT( sourceLine == e.sourceLine() ); @@ -46,9 +46,9 @@ ExceptionTest::testConstructor() void ExceptionTest::testDefaultConstructor() { - CppUnit::Exception e; + CPPUNIT_NS::Exception e; - CPPUNIT_ASSERT( CppUnit::Message() == e.message() ); + CPPUNIT_ASSERT( CPPUNIT_NS::Message() == e.message() ); CPPUNIT_ASSERT( !e.sourceLine().isValid() ); } @@ -56,9 +56,9 @@ ExceptionTest::testDefaultConstructor() void ExceptionTest::testCopyConstructor() { - CppUnit::SourceLine sourceLine( "fileName.cpp", 123 ); - CppUnit::Exception e( CppUnit::Message("message"), sourceLine ); - CppUnit::Exception other( e ); + CPPUNIT_NS::SourceLine sourceLine( "fileName.cpp", 123 ); + CPPUNIT_NS::Exception e( CPPUNIT_NS::Message("message"), sourceLine ); + CPPUNIT_NS::Exception other( e ); checkIsSame( e, other ); } @@ -66,9 +66,9 @@ ExceptionTest::testCopyConstructor() void ExceptionTest::testAssignment() { - CppUnit::SourceLine sourceLine( "fileName.cpp", 123 ); - CppUnit::Exception e( CppUnit::Message("message"), sourceLine ); - CppUnit::Exception other; + CPPUNIT_NS::SourceLine sourceLine( "fileName.cpp", 123 ); + CPPUNIT_NS::Exception e( CPPUNIT_NS::Message("message"), sourceLine ); + CPPUNIT_NS::Exception other; other = e; checkIsSame( e, other ); } @@ -77,16 +77,16 @@ ExceptionTest::testAssignment() void ExceptionTest::testClone() { - CppUnit::SourceLine sourceLine( "fileName.cpp", 123 ); - CppUnit::Exception e( CppUnit::Message("message"), sourceLine ); - std::auto_ptr<CppUnit::Exception> other( e.clone() ); + CPPUNIT_NS::SourceLine sourceLine( "fileName.cpp", 123 ); + CPPUNIT_NS::Exception e( CPPUNIT_NS::Message("message"), sourceLine ); + std::auto_ptr<CPPUNIT_NS::Exception> other( e.clone() ); checkIsSame( e, *other.get() ); } void -ExceptionTest::checkIsSame( CppUnit::Exception &e, - CppUnit::Exception &other ) +ExceptionTest::checkIsSame( CPPUNIT_NS::Exception &e, + CPPUNIT_NS::Exception &other ) { std::string eWhat( e.what() ); std::string otherWhat( other.what() ); diff --git a/examples/cppunittest/ExceptionTest.h b/examples/cppunittest/ExceptionTest.h index 41bcda2..a3b4c91 100644 --- a/examples/cppunittest/ExceptionTest.h +++ b/examples/cppunittest/ExceptionTest.h @@ -4,7 +4,7 @@ #include <cppunit/extensions/HelperMacros.h> -class ExceptionTest : public CppUnit::TestFixture +class ExceptionTest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( ExceptionTest ); CPPUNIT_TEST( testConstructor ); @@ -30,8 +30,8 @@ public: private: ExceptionTest( const ExceptionTest © ); void operator =( const ExceptionTest © ); - void checkIsSame( CppUnit::Exception &e, - CppUnit::Exception &other ); + void checkIsSame( CPPUNIT_NS::Exception &e, + CPPUNIT_NS::Exception &other ); private: }; diff --git a/examples/cppunittest/HelperMacrosTest.cpp b/examples/cppunittest/HelperMacrosTest.cpp index 3674416..311b4a7 100644 --- a/examples/cppunittest/HelperMacrosTest.cpp +++ b/examples/cppunittest/HelperMacrosTest.cpp @@ -10,7 +10,7 @@ - no unit test for CPPUNIT_TEST_SUITE_REGISTRATION... */ -class FailTestFixture : public CppUnit::TestFixture +class FailTestFixture : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( FailTestFixture ); CPPUNIT_TEST_FAIL( testFail ); @@ -23,7 +23,7 @@ public: }; -class FailToFailTestFixture : public CppUnit::TestFixture +class FailToFailTestFixture : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( FailToFailTestFixture ); CPPUNIT_TEST_FAIL( testFailToFail ); @@ -35,7 +35,7 @@ public: }; -class ExceptionTestFixture : public CppUnit::TestFixture +class ExceptionTestFixture : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( ExceptionTestFixture ); CPPUNIT_TEST_EXCEPTION( testException, FailureException ); @@ -48,7 +48,7 @@ public: }; -class ExceptionNotCaughtTestFixture : public CppUnit::TestFixture +class ExceptionNotCaughtTestFixture : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( ExceptionNotCaughtTestFixture ); CPPUNIT_TEST_EXCEPTION( testExceptionNotCaught, FailureException ); @@ -60,14 +60,14 @@ public: }; -class CustomTestTestFixture : public CppUnit::TestFixture +class CustomTestTestFixture : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( CustomTestTestFixture ); CPPUNIT_TEST_CUSTOM( makeCustomTest ); CPPUNIT_TEST_SUITE_END(); public: - static CppUnit::Test *makeCustomTest( const ThisTestFixtureFactory &factory, - const CppUnit::TestNamer &namer ) + static CPPUNIT_NS::Test *makeCustomTest( const ThisTestFixtureFactory &factory, + const CPPUNIT_NS::TestNamer &namer ) { MockTestCase *test = new MockTestCase( namer.getTestNameFor( "myCustomTest" ) ); test->makeRunTestThrow(); @@ -76,15 +76,15 @@ public: }; -class CustomsTestTestFixture : public CppUnit::TestFixture +class CustomsTestTestFixture : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( CustomsTestTestFixture ); CPPUNIT_TEST_CUSTOMS( addCustomTests ); CPPUNIT_TEST_SUITE_END(); public: - static void addCustomTests( CppUnit::TestSuite *suite, + static void addCustomTests( CPPUNIT_NS::TestSuite *suite, const ThisTestFixtureFactory &factory, - const CppUnit::TestNamer &namer ) + const CPPUNIT_NS::TestNamer &namer ) { MockTestCase *test1 = new MockTestCase( namer.getTestNameFor( "myCustomTest1" ) ); test1->makeRunTestThrow(); @@ -104,7 +104,7 @@ public: -class AddTestTestFixture : public CppUnit::TestFixture +class AddTestTestFixture : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( AddTestTestFixture ); TEST_ADD_N_MOCK( 7 ); @@ -132,7 +132,7 @@ void HelperMacrosTest::setUp() { m_testListener = new MockTestListener( "mock-testlistener" ); - m_result = new CppUnit::TestResult(); + m_result = new CPPUNIT_NS::TestResult(); m_result->addListener( m_testListener ); } @@ -148,7 +148,7 @@ HelperMacrosTest::tearDown() void HelperMacrosTest::testNoSubclassing() { - std::auto_ptr<CppUnit::TestSuite> suite( BaseTestCase::suite() ); + std::auto_ptr<CPPUNIT_NS::TestSuite> suite( BaseTestCase::suite() ); CPPUNIT_ASSERT_EQUAL( 1, suite->countTestCases() ); m_testListener->setExpectedStartTestCall( 1 ); m_testListener->setExpectNoFailure(); @@ -161,7 +161,7 @@ HelperMacrosTest::testNoSubclassing() void HelperMacrosTest::testSubclassing() { - std::auto_ptr<CppUnit::TestSuite> suite( SubclassedTestCase::suite() ); + std::auto_ptr<CPPUNIT_NS::TestSuite> suite( SubclassedTestCase::suite() ); CPPUNIT_ASSERT_EQUAL( 2, suite->countTestCases() ); m_testListener->setExpectedStartTestCall( 2 ); m_testListener->setExpectedAddFailureCall( 1 ); @@ -174,7 +174,7 @@ HelperMacrosTest::testSubclassing() void HelperMacrosTest::testFail() { - std::auto_ptr<CppUnit::TestSuite> suite( FailTestFixture::suite() ); + std::auto_ptr<CPPUNIT_NS::TestSuite> suite( FailTestFixture::suite() ); m_testListener->setExpectedStartTestCall( 1 ); m_testListener->setExpectNoFailure(); @@ -186,7 +186,7 @@ HelperMacrosTest::testFail() void HelperMacrosTest::testFailToFail() { - std::auto_ptr<CppUnit::TestSuite> suite( FailToFailTestFixture::suite() ); + std::auto_ptr<CPPUNIT_NS::TestSuite> suite( FailToFailTestFixture::suite() ); m_testListener->setExpectedStartTestCall( 1 ); m_testListener->setExpectedAddFailureCall( 1 ); @@ -198,7 +198,7 @@ HelperMacrosTest::testFailToFail() void HelperMacrosTest::testException() { - std::auto_ptr<CppUnit::TestSuite> suite( ExceptionTestFixture::suite() ); + std::auto_ptr<CPPUNIT_NS::TestSuite> suite( ExceptionTestFixture::suite() ); m_testListener->setExpectedStartTestCall( 1 ); m_testListener->setExpectNoFailure(); @@ -210,7 +210,7 @@ HelperMacrosTest::testException() void HelperMacrosTest::testExceptionNotCaught() { - std::auto_ptr<CppUnit::TestSuite> suite( ExceptionNotCaughtTestFixture::suite() ); + std::auto_ptr<CPPUNIT_NS::TestSuite> suite( ExceptionNotCaughtTestFixture::suite() ); m_testListener->setExpectedStartTestCall( 1 ); m_testListener->setExpectedAddFailureCall( 1 ); @@ -222,7 +222,7 @@ HelperMacrosTest::testExceptionNotCaught() void HelperMacrosTest::testCustomTest() { - std::auto_ptr<CppUnit::TestSuite> suite( CustomTestTestFixture::suite() ); + std::auto_ptr<CPPUNIT_NS::TestSuite> suite( CustomTestTestFixture::suite() ); m_testListener->setExpectedStartTestCall( 1 ); m_testListener->setExpectedAddFailureCall( 1 ); @@ -234,7 +234,7 @@ HelperMacrosTest::testCustomTest() void HelperMacrosTest::testCustomTests() { - std::auto_ptr<CppUnit::TestSuite> suite( CustomsTestTestFixture::suite() ); + std::auto_ptr<CPPUNIT_NS::TestSuite> suite( CustomsTestTestFixture::suite() ); m_testListener->setExpectedStartTestCall( 2 ); m_testListener->setExpectedAddFailureCall( 1 ); @@ -246,7 +246,7 @@ HelperMacrosTest::testCustomTests() void HelperMacrosTest::testAddTest() { - std::auto_ptr<CppUnit::TestSuite> suite( AddTestTestFixture::suite() ); + std::auto_ptr<CPPUNIT_NS::TestSuite> suite( AddTestTestFixture::suite() ); m_testListener->setExpectedStartTestCall( 7 ); m_testListener->setExpectedAddFailureCall( 0 ); diff --git a/examples/cppunittest/HelperMacrosTest.h b/examples/cppunittest/HelperMacrosTest.h index bba8a22..1f3a32a 100644 --- a/examples/cppunittest/HelperMacrosTest.h +++ b/examples/cppunittest/HelperMacrosTest.h @@ -5,7 +5,7 @@ #include "MockTestListener.h" -class HelperMacrosTest : public CppUnit::TestFixture +class HelperMacrosTest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( HelperMacrosTest ); CPPUNIT_TEST( testNoSubclassing ); @@ -45,7 +45,7 @@ private: void operator =( const HelperMacrosTest © ); private: - CppUnit::TestResult *m_result; + CPPUNIT_NS::TestResult *m_result; MockTestListener *m_testListener; }; diff --git a/examples/cppunittest/MessageTest.cpp b/examples/cppunittest/MessageTest.cpp index dd60200..47a34da 100644 --- a/examples/cppunittest/MessageTest.cpp +++ b/examples/cppunittest/MessageTest.cpp @@ -18,7 +18,7 @@ MessageTest::~MessageTest() void MessageTest::setUp() { - m_message = new CppUnit::Message(); + m_message = new CPPUNIT_NS::Message(); } @@ -92,7 +92,7 @@ MessageTest::testAddDetail3() void MessageTest::testAddDetailEmptyMessage() { - m_message->addDetail( CppUnit::Message() ); + m_message->addDetail( CPPUNIT_NS::Message() ); CPPUNIT_ASSERT_EQUAL( 0, m_message->detailCount() ); } @@ -102,7 +102,7 @@ MessageTest::testAddDetailMessage() { std::string expected1( "first" ); std::string expected2( "second" ); - m_message->addDetail( CppUnit::Message( "shortDesc", expected1, expected2 ) ); + m_message->addDetail( CPPUNIT_NS::Message( "shortDesc", expected1, expected2 ) ); CPPUNIT_ASSERT_EQUAL( 2, m_message->detailCount() ); CPPUNIT_ASSERT_EQUAL( expected1, m_message->detailAt(0) ); CPPUNIT_ASSERT_EQUAL( expected2, m_message->detailAt(1) ); @@ -131,7 +131,7 @@ void MessageTest::testConstructor() { std::string expected( "short" ); - CppUnit::Message message( expected ); + CPPUNIT_NS::Message message( expected ); CPPUNIT_ASSERT_EQUAL( expected, message.shortDescription() ); CPPUNIT_ASSERT_EQUAL( 0, message.detailCount() ); @@ -143,7 +143,7 @@ MessageTest::testConstructorDetail1() { std::string expected( "short" ); std::string expected1( "detail-1" ); - CppUnit::Message message( expected, expected1 ); + CPPUNIT_NS::Message message( expected, expected1 ); CPPUNIT_ASSERT_EQUAL( expected, message.shortDescription() ); CPPUNIT_ASSERT_EQUAL( 1, message.detailCount() ); @@ -157,7 +157,7 @@ MessageTest::testConstructorDetail2() std::string expected( "short" ); std::string expected1( "detail-1" ); std::string expected2( "detail-2" ); - CppUnit::Message message( expected, expected1, expected2 ); + CPPUNIT_NS::Message message( expected, expected1, expected2 ); CPPUNIT_ASSERT_EQUAL( expected, message.shortDescription() ); CPPUNIT_ASSERT_EQUAL( 2, message.detailCount() ); @@ -173,7 +173,7 @@ MessageTest::testConstructorDetail3() std::string expected1( "detail-1" ); std::string expected2( "detail-2" ); std::string expected3( "detail-3" ); - CppUnit::Message message( expected, expected1, expected2, expected3 ); + CPPUNIT_NS::Message message( expected, expected1, expected2, expected3 ); CPPUNIT_ASSERT_EQUAL( expected, message.shortDescription() ); CPPUNIT_ASSERT_EQUAL( 3, message.detailCount() ); @@ -205,21 +205,21 @@ MessageTest::testDetailsSome() void MessageTest::testEqual() { - CPPUNIT_ASSERT( *m_message == CppUnit::Message() ); + CPPUNIT_ASSERT( *m_message == CPPUNIT_NS::Message() ); - CppUnit::Message message1( "short", "det1", "det2", "det3" ); - CppUnit::Message message2( message1 ); + CPPUNIT_NS::Message message1( "short", "det1", "det2", "det3" ); + CPPUNIT_NS::Message message2( message1 ); CPPUNIT_ASSERT( message1 == message2 ); CPPUNIT_ASSERT( !(*m_message == message1) ); - CppUnit::Message message3( "short" ); + CPPUNIT_NS::Message message3( "short" ); CPPUNIT_ASSERT( !(message3 == message1) ); - CppUnit::Message message4( "long" ); + CPPUNIT_NS::Message message4( "long" ); CPPUNIT_ASSERT( !(message3 == message4) ); - CppUnit::Message message5( "short", "det1", "det-2", "det3" ); + CPPUNIT_NS::Message message5( "short", "det1", "det-2", "det3" ); CPPUNIT_ASSERT( !(message1 == message5) ); } @@ -227,8 +227,8 @@ MessageTest::testEqual() void MessageTest::testNotEqual() { - CppUnit::Message message1( "short", "det1", "det2", "det3" ); - CppUnit::Message message2( "short", "det1", "det-2", "det3" ); + CPPUNIT_NS::Message message1( "short", "det1", "det2", "det3" ); + CPPUNIT_NS::Message message2( "short", "det1", "det-2", "det3" ); CPPUNIT_ASSERT( message1 != message2 ); CPPUNIT_ASSERT( !(message1 != message1) ); } diff --git a/examples/cppunittest/MessageTest.h b/examples/cppunittest/MessageTest.h index b8bbf3a..4c757e8 100644 --- a/examples/cppunittest/MessageTest.h +++ b/examples/cppunittest/MessageTest.h @@ -7,7 +7,7 @@ /// Unit tests for MessageTest -class MessageTest : public CppUnit::TestFixture +class MessageTest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( MessageTest ); CPPUNIT_TEST( testDefaultConstructor ); @@ -68,7 +68,7 @@ private: void operator =( const MessageTest &other ); private: - CppUnit::Message *m_message; + CPPUNIT_NS::Message *m_message; }; diff --git a/examples/cppunittest/MockTestCase.cpp b/examples/cppunittest/MockTestCase.cpp index e6bc335..9f7c2f6 100644 --- a/examples/cppunittest/MockTestCase.cpp +++ b/examples/cppunittest/MockTestCase.cpp @@ -4,7 +4,7 @@ MockTestCase::MockTestCase( std::string name ) - : CppUnit::TestCase( name ) + : CPPUNIT_NS::TestCase( name ) , m_hasSetUpExpectation( false ) , m_expectedSetUpCall( 0 ) , m_actualSetUpCall( 0 ) @@ -90,8 +90,8 @@ MockTestCase::runTest() /* bool -MockTestCase::findTestPath( const CppUnit::Test *test, - CppUnit::TestPath &testPath ) +MockTestCase::findTestPath( const CPPUNIT_NS::Test *test, + CPPUNIT_NS::TestPath &testPath ) { if ( m_passingTest == test ) { diff --git a/examples/cppunittest/MockTestCase.h b/examples/cppunittest/MockTestCase.h index 49739dc..8ff80e4 100644 --- a/examples/cppunittest/MockTestCase.h +++ b/examples/cppunittest/MockTestCase.h @@ -7,10 +7,10 @@ /*! \class MockTestCase * \brief This class represents a mock test case. */ -class MockTestCase : public CppUnit::TestCase +class MockTestCase : public CPPUNIT_NS::TestCase { public: - typedef CppUnit::TestCase SuperClass; // work around VC++ call to super class method. + typedef CPPUNIT_NS::TestCase SuperClass; // work around VC++ call to super class method. /*! Constructs a MockTestCase object. */ @@ -27,7 +27,7 @@ public: void makeSetUpThrow(); void makeTearDownThrow(); void makeRunTestThrow(); - void makeFindTestPathPassFor( const CppUnit::Test *testFound ); + void makeFindTestPathPassFor( const CPPUNIT_NS::Test *testFound ); void verify(); @@ -36,8 +36,8 @@ protected: void setUp(); void tearDown(); void runTest(); -// bool findTestPath( const CppUnit::Test *test, -// CppUnit::TestPath &testPath ); +// bool findTestPath( const CPPUNIT_NS::Test *test, +// CPPUNIT_NS::TestPath &testPath ); private: /// Prevents the use of the copy constructor. @@ -65,7 +65,7 @@ private: bool m_setUpThrow; bool m_tearDownThrow; bool m_runTestThrow; - const CppUnit::Test *m_passingTest; + const CPPUNIT_NS::Test *m_passingTest; }; diff --git a/examples/cppunittest/MockTestListener.cpp b/examples/cppunittest/MockTestListener.cpp index 5b8b506..0cacfd3 100644 --- a/examples/cppunittest/MockTestListener.cpp +++ b/examples/cppunittest/MockTestListener.cpp @@ -42,8 +42,8 @@ MockTestListener::MockTestListener( std::string name ) void -MockTestListener::setExpectFailure( CppUnit::Test *failedTest, - CppUnit::Exception *thrownException, +MockTestListener::setExpectFailure( CPPUNIT_NS::Test *failedTest, + CPPUNIT_NS::Exception *thrownException, bool isError ) { m_hasExpectationForAddFailure = true; @@ -79,7 +79,7 @@ MockTestListener::setExpectedAddFailureCall( int callCount ) void -MockTestListener::setExpectStartTest( CppUnit::Test *test ) +MockTestListener::setExpectStartTest( CPPUNIT_NS::Test *test ) { m_hasExpectationForStartTest = true; m_hasParametersExpectationForStartTest = true; @@ -97,7 +97,7 @@ MockTestListener::setExpectedStartTestCall( int callCount ) void -MockTestListener::setExpectEndTest( CppUnit::Test *test ) +MockTestListener::setExpectEndTest( CPPUNIT_NS::Test *test ) { m_hasExpectationForEndTest = true; m_hasParametersExpectationForEndTest = true; @@ -115,7 +115,7 @@ MockTestListener::setExpectedEndTestCall( int callCount ) void -MockTestListener::setExpectStartSuite( CppUnit::Test *test ) +MockTestListener::setExpectStartSuite( CPPUNIT_NS::Test *test ) { m_hasExpectationForStartSuite = true; m_hasParametersExpectationForStartSuite = true; @@ -133,7 +133,7 @@ MockTestListener::setExpectedStartSuiteCall( int callCount ) void -MockTestListener::setExpectEndSuite( CppUnit::Test *test ) +MockTestListener::setExpectEndSuite( CPPUNIT_NS::Test *test ) { m_hasExpectationForEndSuite = true; m_hasParametersExpectationForEndSuite = true; @@ -151,8 +151,8 @@ MockTestListener::setExpectedEndSuiteCall( int callCount ) void -MockTestListener::setExpectStartTestRun( CppUnit::Test *test, - CppUnit::TestResult *eventManager ) +MockTestListener::setExpectStartTestRun( CPPUNIT_NS::Test *test, + CPPUNIT_NS::TestResult *eventManager ) { m_hasExpectationForStartTestRun = true; m_hasParametersExpectationForStartTestRun = true; @@ -171,8 +171,8 @@ MockTestListener::setExpectedStartTestRunCall( int callCount ) void -MockTestListener::setExpectEndTestRun( CppUnit::Test *test, - CppUnit::TestResult *eventManager ) +MockTestListener::setExpectEndTestRun( CPPUNIT_NS::Test *test, + CPPUNIT_NS::TestResult *eventManager ) { m_hasExpectationForEndTestRun = true; m_hasParametersExpectationForEndTestRun = true; @@ -191,7 +191,7 @@ MockTestListener::setExpectedEndTestRunCall( int callCount ) void -MockTestListener::addFailure( const CppUnit::TestFailure &failure ) +MockTestListener::addFailure( const CPPUNIT_NS::TestFailure &failure ) { if ( m_hasExpectationForAddFailure || m_hasExpectationForSomeFailure ) ++m_addFailureCall; @@ -215,7 +215,7 @@ MockTestListener::addFailure( const CppUnit::TestFailure &failure ) void -MockTestListener::startTest( CppUnit::Test *test ) +MockTestListener::startTest( CPPUNIT_NS::Test *test ) { if ( m_hasExpectationForStartTest ) { @@ -234,7 +234,7 @@ MockTestListener::startTest( CppUnit::Test *test ) void -MockTestListener::endTest( CppUnit::Test *test ) +MockTestListener::endTest( CPPUNIT_NS::Test *test ) { if ( m_hasExpectationForEndTest ) { @@ -252,7 +252,7 @@ MockTestListener::endTest( CppUnit::Test *test ) void -MockTestListener::startSuite( CppUnit::Test *test ) +MockTestListener::startSuite( CPPUNIT_NS::Test *test ) { if ( m_hasExpectationForStartSuite ) { @@ -270,7 +270,7 @@ MockTestListener::startSuite( CppUnit::Test *test ) void -MockTestListener::endSuite( CppUnit::Test *test ) +MockTestListener::endSuite( CPPUNIT_NS::Test *test ) { if ( m_hasExpectationForEndSuite ) { @@ -288,8 +288,8 @@ MockTestListener::endSuite( CppUnit::Test *test ) void -MockTestListener::startTestRun( CppUnit::Test *test, - CppUnit::TestResult *eventManager ) +MockTestListener::startTestRun( CPPUNIT_NS::Test *test, + CPPUNIT_NS::TestResult *eventManager ) { if ( m_hasExpectationForStartTestRun ) { @@ -309,8 +309,8 @@ MockTestListener::startTestRun( CppUnit::Test *test, void -MockTestListener::endTestRun( CppUnit::Test *test, - CppUnit::TestResult *eventManager ) +MockTestListener::endTestRun( CPPUNIT_NS::Test *test, + CPPUNIT_NS::TestResult *eventManager ) { if ( m_hasExpectationForEndTestRun ) { diff --git a/examples/cppunittest/MockTestListener.h b/examples/cppunittest/MockTestListener.h index cbcf7b6..17f2dfa 100644 --- a/examples/cppunittest/MockTestListener.h +++ b/examples/cppunittest/MockTestListener.h @@ -5,42 +5,42 @@ #include <string> -class MockTestListener : public CppUnit::TestListener +class MockTestListener : public CPPUNIT_NS::TestListener { public: MockTestListener( std::string name ); virtual ~MockTestListener() {} - void setExpectFailure( CppUnit::Test *failedTest, - CppUnit::Exception *thrownException, + void setExpectFailure( CPPUNIT_NS::Test *failedTest, + CPPUNIT_NS::Exception *thrownException, bool isError ); void setExpectNoFailure(); void setExpectFailure(); void setExpectedAddFailureCall( int callCount ); - void setExpectStartTest( CppUnit::Test *test ); + void setExpectStartTest( CPPUNIT_NS::Test *test ); void setExpectedStartTestCall( int callCount ); - void setExpectEndTest( CppUnit::Test *test ); + void setExpectEndTest( CPPUNIT_NS::Test *test ); void setExpectedEndTestCall( int callCount ); - void setExpectStartSuite( CppUnit::Test *suite ); + void setExpectStartSuite( CPPUNIT_NS::Test *suite ); void setExpectedStartSuiteCall( int callCount ); - void setExpectEndSuite( CppUnit::Test *suite ); + void setExpectEndSuite( CPPUNIT_NS::Test *suite ); void setExpectedEndSuiteCall( int callCount ); - void setExpectStartTestRun( CppUnit::Test *test, - CppUnit::TestResult *eventManager ); + void setExpectStartTestRun( CPPUNIT_NS::Test *test, + CPPUNIT_NS::TestResult *eventManager ); void setExpectedStartTestRunCall( int callCount ); - void setExpectEndTestRun( CppUnit::Test *test, - CppUnit::TestResult *eventManager ); + void setExpectEndTestRun( CPPUNIT_NS::Test *test, + CPPUNIT_NS::TestResult *eventManager ); void setExpectedEndTestRunCall( int callCount ); - void addFailure( const CppUnit::TestFailure &failure ); - void startTest( CppUnit::Test *test ); - void endTest( CppUnit::Test *test ); - void startSuite( CppUnit::Test *suite ); - void endSuite( CppUnit::Test *suite ); - void startTestRun( CppUnit::Test *test, - CppUnit::TestResult *eventManager ); - void endTestRun( CppUnit::Test *test, - CppUnit::TestResult *eventManager ); + void addFailure( const CPPUNIT_NS::TestFailure &failure ); + void startTest( CPPUNIT_NS::Test *test ); + void endTest( CPPUNIT_NS::Test *test ); + void startSuite( CPPUNIT_NS::Test *suite ); + void endSuite( CPPUNIT_NS::Test *suite ); + void startTestRun( CPPUNIT_NS::Test *test, + CPPUNIT_NS::TestResult *eventManager ); + void endTestRun( CPPUNIT_NS::Test *test, + CPPUNIT_NS::TestResult *eventManager ); void verify(); @@ -51,38 +51,38 @@ private: bool m_hasParametersExpectationForStartTest; int m_expectedStartTestCallCount; int m_startTestCall; - CppUnit::Test *m_expectedStartTest; + CPPUNIT_NS::Test *m_expectedStartTest; bool m_hasExpectationForEndTest; bool m_hasParametersExpectationForEndTest; int m_expectedEndTestCallCount; - CppUnit::Test *m_expectedEndTest; + CPPUNIT_NS::Test *m_expectedEndTest; int m_endTestCall; bool m_hasExpectationForStartSuite; bool m_hasParametersExpectationForStartSuite; int m_expectedStartSuiteCallCount; - CppUnit::Test *m_expectedStartSuite; + CPPUNIT_NS::Test *m_expectedStartSuite; int m_startSuiteCall; bool m_hasExpectationForEndSuite; bool m_hasParametersExpectationForEndSuite; int m_expectedEndSuiteCallCount; - CppUnit::Test *m_expectedEndSuite; + CPPUNIT_NS::Test *m_expectedEndSuite; int m_endSuiteCall; bool m_hasExpectationForStartTestRun; bool m_hasParametersExpectationForStartTestRun; int m_expectedStartTestRunCallCount; - CppUnit::Test *m_expectedStartTestRun; - CppUnit::TestResult *m_expectedStartTestRun2; + CPPUNIT_NS::Test *m_expectedStartTestRun; + CPPUNIT_NS::TestResult *m_expectedStartTestRun2; int m_startTestRunCall; bool m_hasExpectationForEndTestRun; bool m_hasParametersExpectationForEndTestRun; int m_expectedEndTestRunCallCount; - CppUnit::Test *m_expectedEndTestRun; - CppUnit::TestResult *m_expectedEndTestRun2; + CPPUNIT_NS::Test *m_expectedEndTestRun; + CPPUNIT_NS::TestResult *m_expectedEndTestRun2; int m_endTestRunCall; bool m_hasExpectationForAddFailure; @@ -90,8 +90,8 @@ private: bool m_hasParametersExpectationForAddFailure; int m_expectedAddFailureCallCount; int m_addFailureCall; - CppUnit::Test *m_expectedFailedTest; - CppUnit::Exception *m_expectedException; + CPPUNIT_NS::Test *m_expectedFailedTest; + CPPUNIT_NS::Exception *m_expectedException; bool m_expectedIsError; }; diff --git a/examples/cppunittest/OrthodoxTest.cpp b/examples/cppunittest/OrthodoxTest.cpp index b20fbe3..0da7180 100644 --- a/examples/cppunittest/OrthodoxTest.cpp +++ b/examples/cppunittest/OrthodoxTest.cpp @@ -20,7 +20,7 @@ void OrthodoxTest::setUp() { m_testListener = new MockTestListener( "mock-listener" ); - m_result = new CppUnit::TestResult(); + m_result = new CPPUNIT_NS::TestResult(); m_result->addListener( m_testListener ); } @@ -36,7 +36,7 @@ OrthodoxTest::tearDown() void OrthodoxTest::testValue() { - CppUnit::Orthodox<Value> test; + CPPUNIT_NS::Orthodox<Value> test; m_testListener->setExpectNoFailure(); test.run( m_result ); m_testListener->verify(); @@ -46,7 +46,7 @@ OrthodoxTest::testValue() void OrthodoxTest::testValueBadConstructor() { - CppUnit::Orthodox<ValueBadConstructor> test; + CPPUNIT_NS::Orthodox<ValueBadConstructor> test; m_testListener->setExpectFailure(); test.run( m_result ); m_testListener->verify(); @@ -56,7 +56,7 @@ OrthodoxTest::testValueBadConstructor() void OrthodoxTest::testValueBadInvert() { - CppUnit::Orthodox<ValueBadInvert> test; + CPPUNIT_NS::Orthodox<ValueBadInvert> test; m_testListener->setExpectFailure(); test.run( m_result ); m_testListener->verify(); @@ -66,7 +66,7 @@ OrthodoxTest::testValueBadInvert() void OrthodoxTest::testValueBadEqual() { - CppUnit::Orthodox<ValueBadEqual> test; + CPPUNIT_NS::Orthodox<ValueBadEqual> test; m_testListener->setExpectFailure(); test.run( m_result ); m_testListener->verify(); @@ -76,7 +76,7 @@ OrthodoxTest::testValueBadEqual() void OrthodoxTest::testValueBadNotEqual() { - CppUnit::Orthodox<ValueBadNotEqual> test; + CPPUNIT_NS::Orthodox<ValueBadNotEqual> test; m_testListener->setExpectFailure(); test.run( m_result ); m_testListener->verify(); @@ -86,7 +86,7 @@ OrthodoxTest::testValueBadNotEqual() void OrthodoxTest::testValueBadCall() { - CppUnit::Orthodox<ValueBadCall> test; + CPPUNIT_NS::Orthodox<ValueBadCall> test; m_testListener->setExpectFailure(); test.run( m_result ); m_testListener->verify(); @@ -96,7 +96,7 @@ OrthodoxTest::testValueBadCall() void OrthodoxTest::testValueBadAssignment() { - CppUnit::Orthodox<ValueBadAssignment> test; + CPPUNIT_NS::Orthodox<ValueBadAssignment> test; m_testListener->setExpectFailure(); test.run( m_result ); m_testListener->verify(); diff --git a/examples/cppunittest/OrthodoxTest.h b/examples/cppunittest/OrthodoxTest.h index b71db84..422c074 100644 --- a/examples/cppunittest/OrthodoxTest.h +++ b/examples/cppunittest/OrthodoxTest.h @@ -5,7 +5,7 @@ #include "MockTestListener.h" -class OrthodoxTest : public CppUnit::TestFixture +class OrthodoxTest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( OrthodoxTest ); CPPUNIT_TEST( testValue ); @@ -169,7 +169,7 @@ private: void operator =( const OrthodoxTest © ); private: - CppUnit::TestResult *m_result; + CPPUNIT_NS::TestResult *m_result; MockTestListener *m_testListener; }; diff --git a/examples/cppunittest/RepeatedTestTest.cpp b/examples/cppunittest/RepeatedTestTest.cpp index 9dfdf6f..272a9a4 100644 --- a/examples/cppunittest/RepeatedTestTest.cpp +++ b/examples/cppunittest/RepeatedTestTest.cpp @@ -22,7 +22,7 @@ void RepeatedTestTest::setUp() { m_test = new RunCountTest(); - m_repeatedTest = new CppUnit::RepeatedTest( m_test, m_repeatCount ); + m_repeatedTest = new CPPUNIT_NS::RepeatedTest( m_test, m_repeatCount ); } @@ -37,7 +37,7 @@ RepeatedTestTest::tearDown() void RepeatedTestTest::testRun() { - CppUnit::TestResult result; + CPPUNIT_NS::TestResult result; m_repeatedTest->run( &result ); CPPUNIT_ASSERT_EQUAL( 17, m_test->m_runCount ); diff --git a/examples/cppunittest/StringToolsTest.cpp b/examples/cppunittest/StringToolsTest.cpp index e2c95cc..7d876f1 100644 --- a/examples/cppunittest/StringToolsTest.cpp +++ b/examples/cppunittest/StringToolsTest.cpp @@ -29,7 +29,7 @@ void StringToolsTest::testToStringInt() { std::string expected = "123456789"; - std::string actual = CppUnit::StringTools::toString( 123456789 ); + std::string actual = CPPUNIT_NS::StringTools::toString( 123456789 ); CPPUNIT_ASSERT_EQUAL( expected, actual ); } @@ -38,7 +38,7 @@ void StringToolsTest::testToStringDouble() { std::string expected = "1234.56"; - std::string actual = CppUnit::StringTools::toString( 1234.56 ); + std::string actual = CPPUNIT_NS::StringTools::toString( 1234.56 ); CPPUNIT_ASSERT_EQUAL( expected, actual ); } @@ -47,8 +47,8 @@ void StringToolsTest::testSplitEmptyString() { std::string text; - CppUnit::StringTools::Strings expected; - CppUnit::StringTools::Strings actual = CppUnit::StringTools::split( text, ';' ); + CPPUNIT_NS::StringTools::Strings expected; + CPPUNIT_NS::StringTools::Strings actual = CPPUNIT_NS::StringTools::split( text, ';' ); CPPUNIT_ASSERT_EQUAL( expected.size(), actual.size() ); CPPUNIT_ASSERT( expected == actual ); @@ -59,9 +59,9 @@ void StringToolsTest::testSplitOneItem() { std::string text = "1"; - CppUnit::StringTools::Strings expected; + CPPUNIT_NS::StringTools::Strings expected; expected.push_back( "1" ); - CppUnit::StringTools::Strings actual = CppUnit::StringTools::split( text, ';' ); + CPPUNIT_NS::StringTools::Strings actual = CPPUNIT_NS::StringTools::split( text, ';' ); CPPUNIT_ASSERT_EQUAL( expected.size(), actual.size() ); CPPUNIT_ASSERT( expected == actual ); @@ -72,10 +72,10 @@ void StringToolsTest::testSplitItemEmpty() { std::string text = "1;"; - CppUnit::StringTools::Strings expected; + CPPUNIT_NS::StringTools::Strings expected; expected.push_back( "1" ); expected.push_back( "" ); - CppUnit::StringTools::Strings actual = CppUnit::StringTools::split( text, ';' ); + CPPUNIT_NS::StringTools::Strings actual = CPPUNIT_NS::StringTools::split( text, ';' ); CPPUNIT_ASSERT_EQUAL( expected.size(), actual.size() ); CPPUNIT_ASSERT( expected == actual ); @@ -86,10 +86,10 @@ void StringToolsTest::testSplitTwoItem() { std::string text = "2;1"; - CppUnit::StringTools::Strings expected; + CPPUNIT_NS::StringTools::Strings expected; expected.push_back( "2" ); expected.push_back( "1" ); - CppUnit::StringTools::Strings actual = CppUnit::StringTools::split( text, ';' ); + CPPUNIT_NS::StringTools::Strings actual = CPPUNIT_NS::StringTools::split( text, ';' ); CPPUNIT_ASSERT_EQUAL( expected.size(), actual.size() ); CPPUNIT_ASSERT( expected == actual ); @@ -100,11 +100,11 @@ void StringToolsTest::testSplitEmptyTwoItem() { std::string text = ";1;2"; - CppUnit::StringTools::Strings expected; + CPPUNIT_NS::StringTools::Strings expected; expected.push_back( "" ); expected.push_back( "1" ); expected.push_back( "2" ); - CppUnit::StringTools::Strings actual = CppUnit::StringTools::split( text, ';' ); + CPPUNIT_NS::StringTools::Strings actual = CPPUNIT_NS::StringTools::split( text, ';' ); CPPUNIT_ASSERT_EQUAL( expected.size(), actual.size() ); CPPUNIT_ASSERT( expected == actual ); @@ -115,11 +115,11 @@ void StringToolsTest::testSplitEmptyItemEmpty() { std::string text = ";1;"; - CppUnit::StringTools::Strings expected; + CPPUNIT_NS::StringTools::Strings expected; expected.push_back( "" ); expected.push_back( "1" ); expected.push_back( "" ); - CppUnit::StringTools::Strings actual = CppUnit::StringTools::split( text, ';' ); + CPPUNIT_NS::StringTools::Strings actual = CPPUNIT_NS::StringTools::split( text, ';' ); CPPUNIT_ASSERT_EQUAL( expected.size(), actual.size() ); CPPUNIT_ASSERT( expected == actual ); @@ -130,13 +130,13 @@ void StringToolsTest::testSplitEmptyItemEmptyEmptyItem() { std::string text = ";1;;;2"; - CppUnit::StringTools::Strings expected; + CPPUNIT_NS::StringTools::Strings expected; expected.push_back( "" ); expected.push_back( "1" ); expected.push_back( "" ); expected.push_back( "" ); expected.push_back( "2" ); - CppUnit::StringTools::Strings actual = CppUnit::StringTools::split( text, ';' ); + CPPUNIT_NS::StringTools::Strings actual = CPPUNIT_NS::StringTools::split( text, ';' ); CPPUNIT_ASSERT_EQUAL( expected.size(), actual.size() ); CPPUNIT_ASSERT( expected == actual ); @@ -149,7 +149,7 @@ StringToolsTest::testWrapEmpty() std::string text = ""; std::string expected = ""; - std::string actual = CppUnit::StringTools::wrap( text, 6 ); + std::string actual = CPPUNIT_NS::StringTools::wrap( text, 6 ); CPPUNIT_ASSERT_EQUAL( expected, actual ); } @@ -160,7 +160,7 @@ StringToolsTest::testWrapNotNeeded() std::string text = "abcd"; std::string expected = text; - std::string actual = CppUnit::StringTools::wrap( text, 6 ); + std::string actual = CPPUNIT_NS::StringTools::wrap( text, 6 ); CPPUNIT_ASSERT_EQUAL( expected, actual ); } @@ -171,7 +171,7 @@ StringToolsTest::testWrapLimitNotNeeded() std::string text = "abcdef"; std::string expected = text; - std::string actual = CppUnit::StringTools::wrap( text, 6 ); + std::string actual = CPPUNIT_NS::StringTools::wrap( text, 6 ); CPPUNIT_ASSERT_EQUAL( expected, actual ); } @@ -182,7 +182,7 @@ StringToolsTest::testWrapOneNeeded() std::string text = "abcdefghi"; std::string expected = "abcdef\nghi"; - std::string actual = CppUnit::StringTools::wrap( text, 6 ); + std::string actual = CPPUNIT_NS::StringTools::wrap( text, 6 ); CPPUNIT_ASSERT_EQUAL( expected, actual ); } @@ -193,7 +193,7 @@ StringToolsTest::testWrapTwoNeeded() std::string text = "abcdefghijklmnop"; std::string expected = "abcdef\nghijkl\nmnop"; - std::string actual = CppUnit::StringTools::wrap( text, 6 ); + std::string actual = CPPUNIT_NS::StringTools::wrap( text, 6 ); CPPUNIT_ASSERT_EQUAL( expected, actual ); } @@ -204,7 +204,7 @@ StringToolsTest::testWrapLimitTwoNeeded() std::string text = "abcdefghijklmnopqr"; std::string expected = "abcdef\nghijkl\nmnopqr"; - std::string actual = CppUnit::StringTools::wrap( text, 6 ); + std::string actual = CPPUNIT_NS::StringTools::wrap( text, 6 ); CPPUNIT_ASSERT_EQUAL( expected, actual ); } @@ -215,7 +215,7 @@ StringToolsTest::testWrapOneNeededTwoNeeded() std::string text = "123456789\nabcdefghijklmno"; std::string expected = "123456\n789\nabcdef\nghijkl\nmno"; - std::string actual = CppUnit::StringTools::wrap( text, 6 ); + std::string actual = CPPUNIT_NS::StringTools::wrap( text, 6 ); CPPUNIT_ASSERT_EQUAL( expected, actual ); } @@ -226,7 +226,7 @@ StringToolsTest::testWrapNotNeededEmptyLinesOneNeeded() std::string text = "12345\n\n\n\nabcdefghi"; std::string expected = "12345\n\n\n\nabcdef\nghi"; - std::string actual = CppUnit::StringTools::wrap( text, 6 ); + std::string actual = CPPUNIT_NS::StringTools::wrap( text, 6 ); CPPUNIT_ASSERT_EQUAL( expected, actual ); } diff --git a/examples/cppunittest/SynchronizedTestResult.h b/examples/cppunittest/SynchronizedTestResult.h index fca3d26..284a639 100644 --- a/examples/cppunittest/SynchronizedTestResult.h +++ b/examples/cppunittest/SynchronizedTestResult.h @@ -4,7 +4,7 @@ #include <cppunit/TestResultCollector.h> -class SynchronizedTestResult : public CppUnit::TestResultCollector +class SynchronizedTestResult : public CPPUNIT_NS::TestResultCollector { public: @@ -16,7 +16,7 @@ public: virtual void unlocked() {} }; - class ObservedSynchronizationObject : public CppUnit::SynchronizedObject::SynchronizationObject + class ObservedSynchronizationObject : public CPPUNIT_NS::SynchronizedObject::SynchronizationObject { public: ObservedSynchronizationObject( SynchronizationObjectListener *listener ) : diff --git a/examples/cppunittest/TestAssertTest.cpp b/examples/cppunittest/TestAssertTest.cpp index 96eaa7f..da471ad 100644 --- a/examples/cppunittest/TestAssertTest.cpp +++ b/examples/cppunittest/TestAssertTest.cpp @@ -79,7 +79,7 @@ TestAssertTest::testAssertMessageFalse() { CPPUNIT_ASSERT_MESSAGE( message, 2==3 ); } - catch( CppUnit::Exception &e ) + catch( CPPUNIT_NS::Exception &e ) { exceptionCaught = true; // ok, we were expecting an exception. checkMessageContains( &e, message ); @@ -134,7 +134,7 @@ TestAssertTest::testFail() { CPPUNIT_FAIL( failure ); } - catch( CppUnit::Exception &e ) + catch( CPPUNIT_NS::Exception &e ) { exceptionCaught = true; checkMessageContains( &e, failure ); @@ -144,7 +144,7 @@ TestAssertTest::testFail() void -TestAssertTest::checkMessageContains( CppUnit::Exception *e, +TestAssertTest::checkMessageContains( CPPUNIT_NS::Exception *e, std::string expected ) { std::string actual = e->what(); diff --git a/examples/cppunittest/TestAssertTest.h b/examples/cppunittest/TestAssertTest.h index 80c44a9..5195588 100644 --- a/examples/cppunittest/TestAssertTest.h +++ b/examples/cppunittest/TestAssertTest.h @@ -4,7 +4,7 @@ #include <cppunit/extensions/HelperMacros.h> -class TestAssertTest : public CppUnit::TestFixture +class TestAssertTest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( TestAssertTest ); CPPUNIT_TEST( testAssertTrue ); @@ -53,7 +53,7 @@ private: double actual, double delta ); - void checkMessageContains( CppUnit::Exception *e, + void checkMessageContains( CPPUNIT_NS::Exception *e, std::string expectedMessage ); private: diff --git a/examples/cppunittest/TestCallerTest.cpp b/examples/cppunittest/TestCallerTest.cpp index 626368b..bdfb3d0 100644 --- a/examples/cppunittest/TestCallerTest.cpp +++ b/examples/cppunittest/TestCallerTest.cpp @@ -19,7 +19,7 @@ TestCallerTest::ExceptionThrower::testThrowFailureException() void TestCallerTest::ExceptionThrower::testThrowException() { - throw CppUnit::Exception( CppUnit::Message( "expected Exception" ) ); + throw CPPUNIT_NS::Exception( CPPUNIT_NS::Message( "expected Exception" ) ); } @@ -51,7 +51,7 @@ TestCallerTest::setUp() m_testCount = 0; TrackedTestCase::setTracker( this ); m_testListener = new MockTestListener( "listener1" ); - m_result = new CppUnit::TestResult(); + m_result = new CPPUNIT_NS::TestResult(); m_result->addListener( m_testListener ); } @@ -104,7 +104,7 @@ void TestCallerTest::testBasicConstructor() { { - CppUnit::TestCaller<TrackedTestCase> caller( m_testName, + CPPUNIT_NS::TestCaller<TrackedTestCase> caller( m_testName, &TrackedTestCase::test ); checkTestName( caller.getName() ); checkNothingButConstructorCalled(); @@ -122,7 +122,7 @@ TestCallerTest::testReferenceConstructor() { TrackedTestCase testCase; { - CppUnit::TestCaller<TrackedTestCase> caller( "TrackedTestCaseCaller", + CPPUNIT_NS::TestCaller<TrackedTestCase> caller( "TrackedTestCaseCaller", &TrackedTestCase::test, testCase ); checkTestName( caller.getName() ); @@ -141,7 +141,7 @@ TestCallerTest::testPointerConstructor() { TrackedTestCase *testCase = new TrackedTestCase(); { - CppUnit::TestCaller<TrackedTestCase> caller( m_testName, + CPPUNIT_NS::TestCaller<TrackedTestCase> caller( m_testName, &TrackedTestCase::test, testCase ); checkTestName( caller.getName() ); @@ -158,7 +158,7 @@ TestCallerTest::testPointerConstructor() void TestCallerTest::testExpectFailureException() { - CppUnit::TestCaller<ExceptionThrower,FailureException> caller( + CPPUNIT_NS::TestCaller<ExceptionThrower,FailureException> caller( m_testName, &ExceptionThrower::testThrowFailureException ); m_testListener->setExpectNoFailure(); @@ -170,7 +170,7 @@ TestCallerTest::testExpectFailureException() void TestCallerTest::testExpectException() { - CppUnit::TestCaller<ExceptionThrower,CppUnit::Exception> caller( + CPPUNIT_NS::TestCaller<ExceptionThrower,CPPUNIT_NS::Exception> caller( m_testName, &ExceptionThrower::testThrowException ); m_testListener->setExpectNoFailure(); @@ -182,7 +182,7 @@ TestCallerTest::testExpectException() void TestCallerTest::testExpectedExceptionNotCaught() { - CppUnit::TestCaller<ExceptionThrower,FailureException> caller( + CPPUNIT_NS::TestCaller<ExceptionThrower,FailureException> caller( m_testName, &ExceptionThrower::testThrowNothing ); m_testListener->setExpectedAddFailureCall( 1 ); diff --git a/examples/cppunittest/TestCallerTest.h b/examples/cppunittest/TestCallerTest.h index d2bcc07..0d8b453 100644 --- a/examples/cppunittest/TestCallerTest.h +++ b/examples/cppunittest/TestCallerTest.h @@ -8,7 +8,7 @@ #include "MockTestListener.h" #include "TrackedTestCase.h" -class TestCallerTest : public CppUnit::TestFixture, +class TestCallerTest : public CPPUNIT_NS::TestFixture, Tracker { CPPUNIT_TEST_SUITE( TestCallerTest ); @@ -35,7 +35,7 @@ public: void testExpectedExceptionNotCaught(); private: - class ExceptionThrower : public CppUnit::TestCase + class ExceptionThrower : public CPPUNIT_NS::TestCase { public: void testThrowFailureException(); @@ -64,7 +64,7 @@ private: int m_testCount; const std::string m_testName; MockTestListener *m_testListener; - CppUnit::TestResult *m_result; + CPPUNIT_NS::TestResult *m_result; }; diff --git a/examples/cppunittest/TestCaseTest.cpp b/examples/cppunittest/TestCaseTest.cpp index 91a3f22..3a948d4 100644 --- a/examples/cppunittest/TestCaseTest.cpp +++ b/examples/cppunittest/TestCaseTest.cpp @@ -27,7 +27,7 @@ void TestCaseTest::setUp() { m_testListener = new MockTestListener( "mock-testlistener" ); - m_result = new CppUnit::TestResult(); + m_result = new CPPUNIT_NS::TestResult(); m_result->addListener( m_testListener ); } @@ -107,7 +107,7 @@ TestCaseTest::checkFailure( bool failSetUp, void TestCaseTest::testCountTestCases() { - CppUnit::TestCase test; + CPPUNIT_NS::TestCase test; CPPUNIT_ASSERT_EQUAL( 1, test.countTestCases() ); } @@ -115,7 +115,7 @@ TestCaseTest::testCountTestCases() void TestCaseTest::testDefaultConstructor() { - CppUnit::TestCase test; + CPPUNIT_NS::TestCase test; CPPUNIT_ASSERT_EQUAL( std::string(""), test.getName() ); } @@ -124,7 +124,7 @@ void TestCaseTest::testConstructorWithName() { std::string testName( "TestName" ); - CppUnit::TestCase test( testName ); + CPPUNIT_NS::TestCase test( testName ); CPPUNIT_ASSERT_EQUAL( testName, test.getName() ); } @@ -148,7 +148,7 @@ TestCaseTest::testTwoRun() void TestCaseTest::testGetChildTestCount() { - CppUnit::TestCase test( "test" ); + CPPUNIT_NS::TestCase test( "test" ); CPPUNIT_ASSERT_EQUAL( 0, test.getChildTestCount() ); } @@ -156,6 +156,6 @@ TestCaseTest::testGetChildTestCount() void TestCaseTest::testGetChildTestAtThrow() { - CppUnit::TestCase test( "test" ); + CPPUNIT_NS::TestCase test( "test" ); test.getChildTestAt( 0 ); } diff --git a/examples/cppunittest/TestCaseTest.h b/examples/cppunittest/TestCaseTest.h index 8fb83cc..48c73ae 100644 --- a/examples/cppunittest/TestCaseTest.h +++ b/examples/cppunittest/TestCaseTest.h @@ -12,7 +12,7 @@ #include <stdexcept> -class TestCaseTest : public CppUnit::TestFixture +class TestCaseTest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( TestCaseTest ); CPPUNIT_TEST( testSetUpFailure ); @@ -62,10 +62,10 @@ private: void checkResult( int failures, int errors, int testsRun, - CppUnit::TestResult *result ); + CPPUNIT_NS::TestResult *result ); */ private: - CppUnit::TestResult *m_result; + CPPUNIT_NS::TestResult *m_result; MockTestListener *m_testListener; }; diff --git a/examples/cppunittest/TestDecoratorTest.cpp b/examples/cppunittest/TestDecoratorTest.cpp index 8ff257d..48dd76d 100644 --- a/examples/cppunittest/TestDecoratorTest.cpp +++ b/examples/cppunittest/TestDecoratorTest.cpp @@ -21,7 +21,7 @@ void TestDecoratorTest::setUp() { m_test = new MockTestCase( "mocktest" ); - m_decorator = new CppUnit::TestDecorator( m_test ); + m_decorator = new CPPUNIT_NS::TestDecorator( m_test ); } @@ -48,7 +48,7 @@ TestDecoratorTest::testRun() m_test->setExpectedSetUpCall( 1 ); m_test->setExpectedRunTestCall( 1 ); m_test->setExpectedTearDownCall( 1 ); - CppUnit::TestResult result; + CPPUNIT_NS::TestResult result; m_decorator->run( &result ); m_test->verify(); diff --git a/examples/cppunittest/TestDecoratorTest.h b/examples/cppunittest/TestDecoratorTest.h index 860d0b6..7a098c9 100644 --- a/examples/cppunittest/TestDecoratorTest.h +++ b/examples/cppunittest/TestDecoratorTest.h @@ -6,7 +6,7 @@ #include "MockTestCase.h" -class TestDecoratorTest : public CppUnit::TestFixture +class TestDecoratorTest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( TestDecoratorTest ); CPPUNIT_TEST( testCountTestCases ); @@ -31,7 +31,7 @@ private: private: MockTestCase *m_test; - CppUnit::TestDecorator *m_decorator; + CPPUNIT_NS::TestDecorator *m_decorator; }; diff --git a/examples/cppunittest/TestFailureTest.cpp b/examples/cppunittest/TestFailureTest.cpp index d48f286..6c76820 100644 --- a/examples/cppunittest/TestFailureTest.cpp +++ b/examples/cppunittest/TestFailureTest.cpp @@ -34,8 +34,8 @@ TestFailureTest::tearDown() void TestFailureTest::testConstructorAndGetters() { - CppUnit::TestCase test; - CppUnit::Exception *error = new ObservedException( this ); + CPPUNIT_NS::TestCase test; + CPPUNIT_NS::Exception *error = new ObservedException( this ); checkTestFailure( &test, error, false ); CPPUNIT_ASSERT( m_exceptionDestroyed ); } @@ -44,8 +44,8 @@ TestFailureTest::testConstructorAndGetters() void TestFailureTest::testConstructorAndGettersForError() { - CppUnit::TestCase test; - CppUnit::Exception *error = new ObservedException( this ); + CPPUNIT_NS::TestCase test; + CPPUNIT_NS::Exception *error = new ObservedException( this ); checkTestFailure( &test, error, true ); CPPUNIT_ASSERT( m_exceptionDestroyed ); } @@ -59,11 +59,11 @@ TestFailureTest::exceptionDestroyed() void -TestFailureTest::checkTestFailure( CppUnit::Test *test, - CppUnit::Exception *error, +TestFailureTest::checkTestFailure( CPPUNIT_NS::Test *test, + CPPUNIT_NS::Exception *error, bool isError ) { - CppUnit::TestFailure failure( test, error, isError ); + CPPUNIT_NS::TestFailure failure( test, error, isError ); CPPUNIT_ASSERT_EQUAL( test, failure.failedTest() ); CPPUNIT_ASSERT_EQUAL( error, failure.thrownException() ); CPPUNIT_ASSERT_EQUAL( isError, failure.isError() ); diff --git a/examples/cppunittest/TestFailureTest.h b/examples/cppunittest/TestFailureTest.h index 8149a2e..84f41e9 100644 --- a/examples/cppunittest/TestFailureTest.h +++ b/examples/cppunittest/TestFailureTest.h @@ -4,7 +4,7 @@ #include <cppunit/extensions/HelperMacros.h> -class TestFailureTest : public CppUnit::TestFixture +class TestFailureTest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( TestFailureTest ); CPPUNIT_TEST( testConstructorAndGetters ); @@ -24,11 +24,11 @@ public: void exceptionDestroyed(); private: - class ObservedException : public CppUnit::Exception + class ObservedException : public CPPUNIT_NS::Exception { public: ObservedException( TestFailureTest *listener ) : - CppUnit::Exception( CppUnit::Message("ObservedException" ) ), + CPPUNIT_NS::Exception( CPPUNIT_NS::Message("ObservedException" ) ), m_listener( listener ) { } @@ -44,8 +44,8 @@ private: TestFailureTest( const TestFailureTest © ); void operator =( const TestFailureTest © ); - void checkTestFailure( CppUnit::Test *test, - CppUnit::Exception *error, + void checkTestFailure( CPPUNIT_NS::Test *test, + CPPUNIT_NS::Exception *error, bool isError ); private: diff --git a/examples/cppunittest/TestPathTest.cpp b/examples/cppunittest/TestPathTest.cpp index bf89581..d664273 100644 --- a/examples/cppunittest/TestPathTest.cpp +++ b/examples/cppunittest/TestPathTest.cpp @@ -19,16 +19,16 @@ TestPathTest::~TestPathTest() void TestPathTest::setUp() { - m_path = new CppUnit::TestPath(); - m_test1 = new CppUnit::TestCase( "test1" ); - m_test2 = new CppUnit::TestCase( "test2" ); - m_test3 = new CppUnit::TestCase( "test3" ); - m_test4 = new CppUnit::TestCase( "test4" ); - - m_suite1 = new CppUnit::TestSuite( "All Tests" ); - m_suite2 = new CppUnit::TestSuite( "Custom" ); - m_testSuite2a = new CppUnit::TestCase( "MyTest::testDefaultConstructor" ); - m_testSuite2b = new CppUnit::TestCase( "MyTest::testConstructor" ); + m_path = new CPPUNIT_NS::TestPath(); + m_test1 = new CPPUNIT_NS::TestCase( "test1" ); + m_test2 = new CPPUNIT_NS::TestCase( "test2" ); + m_test3 = new CPPUNIT_NS::TestCase( "test3" ); + m_test4 = new CPPUNIT_NS::TestCase( "test4" ); + + m_suite1 = new CPPUNIT_NS::TestSuite( "All Tests" ); + m_suite2 = new CPPUNIT_NS::TestSuite( "Custom" ); + m_testSuite2a = new CPPUNIT_NS::TestCase( "MyTest::testDefaultConstructor" ); + m_testSuite2b = new CPPUNIT_NS::TestCase( "MyTest::testConstructor" ); m_suite2->addTest( m_testSuite2a ); m_suite2->addTest( m_testSuite2b ); m_suite1->addTest( m_suite2 ); @@ -108,7 +108,7 @@ TestPathTest::testGetChildTestThrowIfNotValid() void TestPathTest::testAddPath() { - CppUnit::TestPath path; + CPPUNIT_NS::TestPath path; path.add( m_test2 ); path.add( m_test3 ); @@ -125,7 +125,7 @@ TestPathTest::testAddPath() void TestPathTest::testAddInvalidPath() { - CppUnit::TestPath path; + CPPUNIT_NS::TestPath path; m_path->add( path ); CPPUNIT_ASSERT( !m_path->isValid() ); @@ -236,7 +236,7 @@ TestPathTest::testInsertThrow2() void TestPathTest::testInsertPath() { - CppUnit::TestPath path; + CPPUNIT_NS::TestPath path; path.add( m_test2 ); path.add( m_test3 ); @@ -255,7 +255,7 @@ TestPathTest::testInsertPath() void TestPathTest::testInsertPathThrow() { - CppUnit::TestPath path; + CPPUNIT_NS::TestPath path; path.add( m_test2 ); m_path->insert( path, 1 ); @@ -265,7 +265,7 @@ TestPathTest::testInsertPathThrow() void TestPathTest::testInsertPathDontThrowIfInvalid() { - CppUnit::TestPath path; + CPPUNIT_NS::TestPath path; m_path->insert( path, 1 ); } @@ -273,7 +273,7 @@ TestPathTest::testInsertPathDontThrowIfInvalid() void TestPathTest::testRootConstructor() { - CppUnit::TestPath path( m_test1 ); + CPPUNIT_NS::TestPath path( m_test1 ); CPPUNIT_ASSERT( path.isValid() ); CPPUNIT_ASSERT_EQUAL( 1, path.getTestCount() ); CPPUNIT_ASSERT( m_test1 == path.getTestAt(0) ); @@ -287,7 +287,7 @@ TestPathTest::testPathSliceConstructorCopyUntilEnd() m_path->add( m_test2 ); m_path->add( m_test3 ); - CppUnit::TestPath path( *m_path, 1 ); + CPPUNIT_NS::TestPath path( *m_path, 1 ); CPPUNIT_ASSERT_EQUAL( 2, path.getTestCount() ); CPPUNIT_ASSERT( m_test2 == path.getTestAt(0) ); @@ -302,7 +302,7 @@ TestPathTest::testPathSliceConstructorCopySpecifiedCount() m_path->add( m_test2 ); m_path->add( m_test3 ); - CppUnit::TestPath path( *m_path, 0, 1 ); + CPPUNIT_NS::TestPath path( *m_path, 0, 1 ); CPPUNIT_ASSERT_EQUAL( 1, path.getTestCount() ); CPPUNIT_ASSERT( m_test1 == path.getTestAt(0) ); @@ -314,7 +314,7 @@ TestPathTest::testPathSliceConstructorCopyNone() { m_path->add( m_test1 ); - CppUnit::TestPath path( *m_path, 0, 0 ); + CPPUNIT_NS::TestPath path( *m_path, 0, 0 ); CPPUNIT_ASSERT_EQUAL( 0, path.getTestCount() ); } @@ -325,7 +325,7 @@ TestPathTest::testPathSliceConstructorNegativeIndex() m_path->add( m_test1 ); m_path->add( m_test2 ); - CppUnit::TestPath path( *m_path, -1, 2 ); + CPPUNIT_NS::TestPath path( *m_path, -1, 2 ); CPPUNIT_ASSERT_EQUAL( 1, path.getTestCount() ); CPPUNIT_ASSERT( m_test1 == path.getTestAt(0) ); @@ -338,7 +338,7 @@ TestPathTest::testPathSliceConstructorAfterEndIndex() m_path->add( m_test1 ); m_path->add( m_test2 ); - CppUnit::TestPath path( *m_path, 2, 5 ); + CPPUNIT_NS::TestPath path( *m_path, 2, 5 ); CPPUNIT_ASSERT_EQUAL( 0, path.getTestCount() ); } @@ -350,7 +350,7 @@ TestPathTest::testPathSliceConstructorNegativeIndexUntilEnd() m_path->add( m_test1 ); m_path->add( m_test2 ); - CppUnit::TestPath path( *m_path, -1 ); + CPPUNIT_NS::TestPath path( *m_path, -1 ); CPPUNIT_ASSERT_EQUAL( 2, path.getTestCount() ); CPPUNIT_ASSERT( m_test1 == path.getTestAt(0) ); @@ -364,7 +364,7 @@ TestPathTest::testPathSliceConstructorNegativeIndexNone() m_path->add( m_test1 ); m_path->add( m_test2 ); - CppUnit::TestPath path( *m_path, -2, 1 ); + CPPUNIT_NS::TestPath path( *m_path, -2, 1 ); CPPUNIT_ASSERT_EQUAL( 0, path.getTestCount() ); } @@ -409,7 +409,7 @@ TestPathTest::testToStringHierarchy() void TestPathTest::testPathStringConstructorRoot() { - CppUnit::TestPath path( m_suite1, "/All Tests" ); + CPPUNIT_NS::TestPath path( m_suite1, "/All Tests" ); CPPUNIT_ASSERT_EQUAL( 1, path.getTestCount() ); CPPUNIT_ASSERT( m_suite1 == path.getTestAt(0) ); @@ -419,7 +419,7 @@ TestPathTest::testPathStringConstructorRoot() void TestPathTest::testPathStringConstructorEmptyIsRoot() { - CppUnit::TestPath path( m_suite1, "" ); + CPPUNIT_NS::TestPath path( m_suite1, "" ); CPPUNIT_ASSERT_EQUAL( 1, path.getTestCount() ); CPPUNIT_ASSERT( m_suite1 == path.getTestAt(0) ); @@ -429,7 +429,7 @@ TestPathTest::testPathStringConstructorEmptyIsRoot() void TestPathTest::testPathStringConstructorHierarchy() { - CppUnit::TestPath path( m_suite1, "/All Tests/Custom/MyTest::testDefaultConstructor" ); + CPPUNIT_NS::TestPath path( m_suite1, "/All Tests/Custom/MyTest::testDefaultConstructor" ); CPPUNIT_ASSERT_EQUAL( 3, path.getTestCount() ); CPPUNIT_ASSERT( m_suite1 == path.getTestAt(0) ); @@ -441,14 +441,14 @@ TestPathTest::testPathStringConstructorHierarchy() void TestPathTest::testPathStringConstructorBadRootThrow() { - CppUnit::TestPath path( m_suite1, "/Custom" ); + CPPUNIT_NS::TestPath path( m_suite1, "/Custom" ); } void TestPathTest::testPathStringConstructorRelativeRoot() { - CppUnit::TestPath path( m_suite1, "All Tests" ); + CPPUNIT_NS::TestPath path( m_suite1, "All Tests" ); CPPUNIT_ASSERT_EQUAL( 1, path.getTestCount() ); CPPUNIT_ASSERT( m_suite1 == path.getTestAt(0) ); @@ -458,7 +458,7 @@ TestPathTest::testPathStringConstructorRelativeRoot() void TestPathTest::testPathStringConstructorRelativeRoot2() { - CppUnit::TestPath path( m_suite1, "Custom" ); + CPPUNIT_NS::TestPath path( m_suite1, "Custom" ); CPPUNIT_ASSERT_EQUAL( 1, path.getTestCount() ); CPPUNIT_ASSERT( m_suite2 == path.getTestAt(0) ); @@ -468,14 +468,14 @@ TestPathTest::testPathStringConstructorRelativeRoot2() void TestPathTest::testPathStringConstructorThrow1() { - CppUnit::TestPath path( m_suite1, "/" ); + CPPUNIT_NS::TestPath path( m_suite1, "/" ); } void TestPathTest::testPathStringConstructorRelativeHierarchy() { - CppUnit::TestPath path( m_suite1, "Custom/MyTest::testConstructor" ); + CPPUNIT_NS::TestPath path( m_suite1, "Custom/MyTest::testConstructor" ); CPPUNIT_ASSERT_EQUAL( 2, path.getTestCount() ); CPPUNIT_ASSERT( m_suite2 == path.getTestAt(0) ); @@ -486,5 +486,5 @@ TestPathTest::testPathStringConstructorRelativeHierarchy() void TestPathTest::testPathStringConstructorBadRelativeHierarchyThrow() { - CppUnit::TestPath path( m_suite1, "Custom/MyBadTest::testConstructor" ); + CPPUNIT_NS::TestPath path( m_suite1, "Custom/MyBadTest::testConstructor" ); } diff --git a/examples/cppunittest/TestPathTest.h b/examples/cppunittest/TestPathTest.h index 6ed4a98..655a807 100644 --- a/examples/cppunittest/TestPathTest.h +++ b/examples/cppunittest/TestPathTest.h @@ -10,7 +10,7 @@ /*! \class TestPathTest * \brief Unit tests for class TestPath. */ -class TestPathTest : public CppUnit::TestFixture +class TestPathTest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( TestPathTest ); CPPUNIT_TEST( testDefaultConstructor ); @@ -126,15 +126,15 @@ private: void operator =( const TestPathTest © ); private: - CppUnit::TestPath *m_path; - CppUnit::TestCase *m_test1; - CppUnit::TestCase *m_test2; - CppUnit::TestCase *m_test3; - CppUnit::TestCase *m_test4; - CppUnit::TestSuite *m_suite1; - CppUnit::TestSuite *m_suite2; - CppUnit::TestCase *m_testSuite2a; - CppUnit::TestCase *m_testSuite2b; + CPPUNIT_NS::TestPath *m_path; + CPPUNIT_NS::TestCase *m_test1; + CPPUNIT_NS::TestCase *m_test2; + CPPUNIT_NS::TestCase *m_test3; + CPPUNIT_NS::TestCase *m_test4; + CPPUNIT_NS::TestSuite *m_suite1; + CPPUNIT_NS::TestSuite *m_suite2; + CPPUNIT_NS::TestCase *m_testSuite2a; + CPPUNIT_NS::TestCase *m_testSuite2b; }; diff --git a/examples/cppunittest/TestResultCollectorTest.cpp b/examples/cppunittest/TestResultCollectorTest.cpp index bb60dd6..0d8fdd6 100644 --- a/examples/cppunittest/TestResultCollectorTest.cpp +++ b/examples/cppunittest/TestResultCollectorTest.cpp @@ -22,10 +22,10 @@ TestResultCollectorTest::setUp() { m_lockCount = 0; m_unlockCount = 0; - m_result = new CppUnit::TestResultCollector(); + m_result = new CPPUNIT_NS::TestResultCollector(); m_synchronizedResult = new SynchronizedTestResult( this ); - m_test = new CppUnit::TestCase(); - m_test2 = new CppUnit::TestCase(); + m_test = new CPPUNIT_NS::TestCase(); + m_test2 = new CPPUNIT_NS::TestCase(); } @@ -49,16 +49,16 @@ TestResultCollectorTest::testConstructor() void TestResultCollectorTest::testAddTwoErrors() { - CppUnit::Message errorMessage1( "First Error" ); - CppUnit::Message errorMessage2( "Second Error" ); + CPPUNIT_NS::Message errorMessage1( "First Error" ); + CPPUNIT_NS::Message errorMessage2( "Second Error" ); { - CppUnit::TestFailure failure1( m_test, - new CppUnit::Exception( errorMessage1 ), + CPPUNIT_NS::TestFailure failure1( m_test, + new CPPUNIT_NS::Exception( errorMessage1 ), true ); m_result->addFailure( failure1 ); - CppUnit::TestFailure failure2( m_test2, - new CppUnit::Exception( errorMessage2 ), + CPPUNIT_NS::TestFailure failure2( m_test2, + new CPPUNIT_NS::Exception( errorMessage2 ), true ); m_result->addFailure( failure2 ); } // ensure that the test result duplicate the failures. @@ -78,16 +78,16 @@ TestResultCollectorTest::testAddTwoErrors() void TestResultCollectorTest::testAddTwoFailures() { - CppUnit::Message errorMessage1( "First Failure" ); - CppUnit::Message errorMessage2( "Second Failure" ); + CPPUNIT_NS::Message errorMessage1( "First Failure" ); + CPPUNIT_NS::Message errorMessage2( "Second Failure" ); { - CppUnit::TestFailure failure1( m_test, - new CppUnit::Exception( errorMessage1 ), + CPPUNIT_NS::TestFailure failure1( m_test, + new CPPUNIT_NS::Exception( errorMessage1 ), false ); m_result->addFailure( failure1 ); - CppUnit::TestFailure failure2( m_test2, - new CppUnit::Exception( errorMessage2 ), + CPPUNIT_NS::TestFailure failure2( m_test2, + new CPPUNIT_NS::Exception( errorMessage2 ), false ); m_result->addFailure( failure2 ); } // ensure that the test result duplicate the failures. @@ -227,12 +227,12 @@ TestResultCollectorTest::checkResult( int failures, void -TestResultCollectorTest::checkFailure( CppUnit::TestFailure *failure, - CppUnit::Message expectedMessage, - CppUnit::Test *expectedTest, +TestResultCollectorTest::checkFailure( CPPUNIT_NS::TestFailure *failure, + CPPUNIT_NS::Message expectedMessage, + CPPUNIT_NS::Test *expectedTest, bool expectedIsError ) { - CppUnit::Message actualMessage( failure->thrownException()->message() ); + CPPUNIT_NS::Message actualMessage( failure->thrownException()->message() ); CPPUNIT_ASSERT( expectedMessage == actualMessage ); CPPUNIT_ASSERT_EQUAL( expectedTest, failure->failedTest() ); CPPUNIT_ASSERT_EQUAL( expectedIsError, failure->isError() ); @@ -286,12 +286,12 @@ TestResultCollectorTest::addError( std::string message ) void TestResultCollectorTest::addFailure( std::string message, - CppUnit::Test *failedTest, + CPPUNIT_NS::Test *failedTest, bool isError, - CppUnit::TestResultCollector *result ) + CPPUNIT_NS::TestResultCollector *result ) { - CppUnit::TestFailure failure( failedTest, - new CppUnit::Exception( CppUnit::Message( message ) ), + CPPUNIT_NS::TestFailure failure( failedTest, + new CPPUNIT_NS::Exception( CPPUNIT_NS::Message( message ) ), isError ); result->addFailure( failure ); } diff --git a/examples/cppunittest/TestResultCollectorTest.h b/examples/cppunittest/TestResultCollectorTest.h index ad3f582..bf7e5ae 100644 --- a/examples/cppunittest/TestResultCollectorTest.h +++ b/examples/cppunittest/TestResultCollectorTest.h @@ -6,7 +6,7 @@ #include "SynchronizedTestResult.h" -class TestResultCollectorTest : public CppUnit::TestFixture, +class TestResultCollectorTest : public CPPUNIT_NS::TestFixture, public SynchronizedTestResult::SynchronizationObjectListener { CPPUNIT_TEST_SUITE( TestResultCollectorTest ); @@ -66,9 +66,9 @@ private: int errors, int testsRun ); - void checkFailure( CppUnit::TestFailure *failure, - CppUnit::Message expectedMessage, - CppUnit::Test *expectedTest, + void checkFailure( CPPUNIT_NS::TestFailure *failure, + CPPUNIT_NS::Message expectedMessage, + CPPUNIT_NS::Test *expectedTest, bool expectedIsError ); void checkWasSuccessful( bool shouldBeSuccessful ); @@ -78,15 +78,15 @@ private: void addFailure( std::string message ); void addError( std::string message ); void addFailure( std::string message, - CppUnit::Test *failedTest, + CPPUNIT_NS::Test *failedTest, bool isError, - CppUnit::TestResultCollector *result ); + CPPUNIT_NS::TestResultCollector *result ); private: - CppUnit::TestResultCollector *m_result; + CPPUNIT_NS::TestResultCollector *m_result; SynchronizedTestResult *m_synchronizedResult; - CppUnit::Test *m_test; - CppUnit::Test *m_test2; + CPPUNIT_NS::Test *m_test; + CPPUNIT_NS::Test *m_test2; int m_lockCount; int m_unlockCount; }; diff --git a/examples/cppunittest/TestResultTest.cpp b/examples/cppunittest/TestResultTest.cpp index b43b1b0..f1987ac 100644 --- a/examples/cppunittest/TestResultTest.cpp +++ b/examples/cppunittest/TestResultTest.cpp @@ -19,10 +19,10 @@ TestResultTest::~TestResultTest() void TestResultTest::setUp() { - m_result = new CppUnit::TestResult(); + m_result = new CPPUNIT_NS::TestResult(); m_listener1 = new MockTestListener( "listener1" ); m_listener2 = new MockTestListener( "listener2" ); - m_dummyTest = new CppUnit::TestCase(); + m_dummyTest = new CPPUNIT_NS::TestCase(); } @@ -54,8 +54,8 @@ TestResultTest::testStop() void TestResultTest::testAddError() { - CppUnit::Exception *dummyException = new CppUnit::Exception( - CppUnit::Message( "some_error" ) ); + CPPUNIT_NS::Exception *dummyException = new CPPUNIT_NS::Exception( + CPPUNIT_NS::Message( "some_error" ) ); m_listener1->setExpectFailure( m_dummyTest, dummyException, true ); m_result->addListener( m_listener1 ); @@ -68,8 +68,8 @@ TestResultTest::testAddError() void TestResultTest::testAddFailure() { - CppUnit::Exception *dummyException = new CppUnit::Exception( - CppUnit::Message("some_error" ) ); + CPPUNIT_NS::Exception *dummyException = new CPPUNIT_NS::Exception( + CPPUNIT_NS::Message("some_error" ) ); m_listener1->setExpectFailure( m_dummyTest, dummyException, false ); m_result->addListener( m_listener1 ); @@ -145,8 +145,8 @@ TestResultTest::testTwoListener() { m_listener1->setExpectStartTest( m_dummyTest ); m_listener2->setExpectStartTest( m_dummyTest ); - CppUnit::Exception *dummyException1 = new CppUnit::Exception( - CppUnit::Message( "some_error" ) ); + CPPUNIT_NS::Exception *dummyException1 = new CPPUNIT_NS::Exception( + CPPUNIT_NS::Message( "some_error" ) ); m_listener1->setExpectFailure( m_dummyTest, dummyException1, true ); m_listener2->setExpectFailure( m_dummyTest, dummyException1, true ); m_listener1->setExpectEndTest( m_dummyTest ); diff --git a/examples/cppunittest/TestResultTest.h b/examples/cppunittest/TestResultTest.h index 44a0f45..28b0369 100644 --- a/examples/cppunittest/TestResultTest.h +++ b/examples/cppunittest/TestResultTest.h @@ -6,7 +6,7 @@ #include "MockTestListener.h" -class TestResultTest : public CppUnit::TestFixture +class TestResultTest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( TestResultTest ); CPPUNIT_TEST( testConstructor ); @@ -46,10 +46,10 @@ private: void operator =( const TestResultTest © ); private: - CppUnit::TestResult *m_result; + CPPUNIT_NS::TestResult *m_result; MockTestListener *m_listener1; MockTestListener *m_listener2; - CppUnit::Test *m_dummyTest; + CPPUNIT_NS::Test *m_dummyTest; }; diff --git a/examples/cppunittest/TestSetUpTest.cpp b/examples/cppunittest/TestSetUpTest.cpp index 5a4bad8..6622d41 100644 --- a/examples/cppunittest/TestSetUpTest.cpp +++ b/examples/cppunittest/TestSetUpTest.cpp @@ -31,8 +31,8 @@ TestSetUpTest::tearDown() void TestSetUpTest::testRun() { - CppUnit::TestResult result; - CppUnit::TestCase test; + CPPUNIT_NS::TestResult result; + CPPUNIT_NS::TestCase test; MockSetUp setUpTest( &test ); setUpTest.run( &result ); diff --git a/examples/cppunittest/TestSetUpTest.h b/examples/cppunittest/TestSetUpTest.h index aa8fcdd..117473b 100644 --- a/examples/cppunittest/TestSetUpTest.h +++ b/examples/cppunittest/TestSetUpTest.h @@ -5,7 +5,7 @@ #include <cppunit/extensions/TestSetUp.h> -class TestSetUpTest : public CppUnit::TestFixture +class TestSetUpTest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( TestSetUpTest ); CPPUNIT_TEST( testRun ); @@ -21,11 +21,11 @@ public: void testRun(); private: - class MockSetUp : public CppUnit::TestSetUp + class MockSetUp : public CPPUNIT_NS::TestSetUp { public: - MockSetUp( CppUnit::Test *test ) - : CppUnit::TestSetUp( test ) + MockSetUp( CPPUNIT_NS::Test *test ) + : CPPUNIT_NS::TestSetUp( test ) , m_setUpCalled( false ) , m_tearDownCalled( false ) { diff --git a/examples/cppunittest/TestSuiteTest.cpp b/examples/cppunittest/TestSuiteTest.cpp index d63dc45..ae6e65a 100644 --- a/examples/cppunittest/TestSuiteTest.cpp +++ b/examples/cppunittest/TestSuiteTest.cpp @@ -21,7 +21,7 @@ TestSuiteTest::~TestSuiteTest() void TestSuiteTest::setUp() { - m_suite = new CppUnit::TestSuite(); + m_suite = new CPPUNIT_NS::TestSuite(); } @@ -36,7 +36,7 @@ void TestSuiteTest::testConstructor() { std::string name( "MySuite" ); - CppUnit::TestSuite suite( name ); + CPPUNIT_NS::TestSuite suite( name ); CPPUNIT_ASSERT_EQUAL( name, suite.getName() ); } @@ -73,7 +73,7 @@ TestSuiteTest::testCountTestCasesWithSubSuite() case2->setExpectedCountTestCasesCall(); MockTestCase *case3 = new MockTestCase( "test3" ); case3->setExpectedCountTestCasesCall(); - CppUnit::TestSuite *subSuite = new CppUnit::TestSuite( "SubSuite"); + CPPUNIT_NS::TestSuite *subSuite = new CPPUNIT_NS::TestSuite( "SubSuite"); subSuite->addTest( case1 ); subSuite->addTest( case2 ); m_suite->addTest( case3 ); @@ -93,7 +93,7 @@ TestSuiteTest::testRunWithOneTest() case1->setExpectedRunTestCall(); m_suite->addTest( case1 ); - CppUnit::TestResult result; + CPPUNIT_NS::TestResult result; m_suite->run( &result ); case1->verify(); @@ -109,13 +109,13 @@ TestSuiteTest::testRunWithOneTestAndSubSuite() case2->setExpectedRunTestCall(); MockTestCase *case3 = new MockTestCase( "test3" ); case3->setExpectedRunTestCall(); - CppUnit::TestSuite *subSuite = new CppUnit::TestSuite( "SubSuite"); + CPPUNIT_NS::TestSuite *subSuite = new CPPUNIT_NS::TestSuite( "SubSuite"); subSuite->addTest( case1 ); subSuite->addTest( case2 ); m_suite->addTest( case3 ); m_suite->addTest( subSuite); - CppUnit::TestResult result; + CPPUNIT_NS::TestResult result; m_suite->run( &result ); case1->verify(); @@ -127,8 +127,8 @@ TestSuiteTest::testRunWithOneTestAndSubSuite() void TestSuiteTest::testGetTests() { - m_suite->addTest( new CppUnit::TestCase( "test1" ) ); - m_suite->addTest( new CppUnit::TestCase( "test2" ) ); + m_suite->addTest( new CPPUNIT_NS::TestCase( "test1" ) ); + m_suite->addTest( new CPPUNIT_NS::TestCase( "test2" ) ); CPPUNIT_ASSERT_EQUAL( 2, int(m_suite->getTests().size()) ); } @@ -136,7 +136,7 @@ TestSuiteTest::testGetTests() void TestSuiteTest::testDeleteContents() { - m_suite->addTest( new CppUnit::TestCase( "test2" ) ); + m_suite->addTest( new CPPUNIT_NS::TestCase( "test2" ) ); m_suite->deleteContents(); CPPUNIT_ASSERT_EQUAL( 0, int(m_suite->getTests().size()) ); } @@ -145,8 +145,8 @@ TestSuiteTest::testDeleteContents() void TestSuiteTest::testGetChildTestCount() { - m_suite->addTest( new CppUnit::TestCase( "test1" ) ); - m_suite->addTest( new CppUnit::TestCase( "test2" ) ); + m_suite->addTest( new CPPUNIT_NS::TestCase( "test1" ) ); + m_suite->addTest( new CPPUNIT_NS::TestCase( "test2" ) ); CPPUNIT_ASSERT_EQUAL( 2, m_suite->getChildTestCount() ); } @@ -155,8 +155,8 @@ TestSuiteTest::testGetChildTestCount() void TestSuiteTest::testGetChildTestAt() { - CppUnit::TestCase *test1 = new CppUnit::TestCase( "test1" ); - CppUnit::TestCase *test2 = new CppUnit::TestCase( "test2" ); + CPPUNIT_NS::TestCase *test1 = new CPPUNIT_NS::TestCase( "test1" ); + CPPUNIT_NS::TestCase *test2 = new CPPUNIT_NS::TestCase( "test2" ); m_suite->addTest( test1 ); m_suite->addTest( test2 ); diff --git a/examples/cppunittest/TestTest.cpp b/examples/cppunittest/TestTest.cpp index c551a95..a98cc08 100644 --- a/examples/cppunittest/TestTest.cpp +++ b/examples/cppunittest/TestTest.cpp @@ -7,7 +7,7 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( TestTest, TestTest::TestTest() : - CppUnit::TestFixture() + CPPUNIT_NS::TestFixture() { } @@ -20,13 +20,13 @@ TestTest::~TestTest() void TestTest::setUp() { - m_suite = new CppUnit::TestSuite( "suite" ); + m_suite = new CPPUNIT_NS::TestSuite( "suite" ); m_test1 = new MockTestCase( "test1" ); m_test2 = new MockTestCase( "test2" ); m_suite->addTest( m_test1 ); m_suite->addTest( m_test2 ); - m_path = new CppUnit::TestPath(); + m_path = new CPPUNIT_NS::TestPath(); } @@ -122,11 +122,11 @@ TestTest::testFindTestThrow() void TestTest::testResolveTestPath() { - CppUnit::TestPath path1 = m_suite->resolveTestPath( "suite"); + CPPUNIT_NS::TestPath path1 = m_suite->resolveTestPath( "suite"); CPPUNIT_ASSERT_EQUAL( 1, path1.getTestCount() ); CPPUNIT_ASSERT( m_suite == path1.getTestAt(0) ); - CppUnit::TestPath path2 = m_suite->resolveTestPath( "suite/test2"); + CPPUNIT_NS::TestPath path2 = m_suite->resolveTestPath( "suite/test2"); CPPUNIT_ASSERT_EQUAL( 2, path2.getTestCount() ); CPPUNIT_ASSERT( m_suite == path2.getTestAt(0) ); CPPUNIT_ASSERT( m_test2 == path2.getTestAt(1) ); diff --git a/examples/cppunittest/TestTest.h b/examples/cppunittest/TestTest.h index fa0cef2..d556ace 100644 --- a/examples/cppunittest/TestTest.h +++ b/examples/cppunittest/TestTest.h @@ -11,7 +11,7 @@ /*! \class TestTest * \brief Unit test for class Test. */ -class TestTest : public CppUnit::TestFixture +class TestTest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( TestTest ); CPPUNIT_TEST( testFindTestPathPointerThis ); @@ -57,10 +57,10 @@ private: void operator =( const TestTest © ); private: - CppUnit::TestSuite *m_suite; + CPPUNIT_NS::TestSuite *m_suite; MockTestCase *m_test1; MockTestCase *m_test2; - CppUnit::TestPath *m_path; + CPPUNIT_NS::TestPath *m_path; }; diff --git a/examples/cppunittest/TrackedTestCase.h b/examples/cppunittest/TrackedTestCase.h index b437033..f665c50 100644 --- a/examples/cppunittest/TrackedTestCase.h +++ b/examples/cppunittest/TrackedTestCase.h @@ -17,7 +17,7 @@ public: }; -class TrackedTestCase : public CppUnit::TestCase +class TrackedTestCase : public CPPUNIT_NS::TestCase { public: TrackedTestCase(); diff --git a/examples/cppunittest/XmlElementTest.cpp b/examples/cppunittest/XmlElementTest.cpp index 585b0ba..02ffee7 100644 --- a/examples/cppunittest/XmlElementTest.cpp +++ b/examples/cppunittest/XmlElementTest.cpp @@ -33,7 +33,7 @@ XmlElementTest::tearDown() void XmlElementTest::testStringContentConstructor() { - CppUnit::XmlElement element( "aName", "someContent" ); + CPPUNIT_NS::XmlElement element( "aName", "someContent" ); CPPUNIT_ASSERT_EQUAL( std::string("aName"), element.name() ); CPPUNIT_ASSERT_EQUAL( std::string("someContent"), element.content() ); } @@ -42,7 +42,7 @@ XmlElementTest::testStringContentConstructor() void XmlElementTest::testNumericContentConstructor() { - CppUnit::XmlElement element( "numericName", 123456789 ); + CPPUNIT_NS::XmlElement element( "numericName", 123456789 ); CPPUNIT_ASSERT_EQUAL( std::string("numericName"), element.name() ); CPPUNIT_ASSERT_EQUAL( std::string("123456789"), element.content() ); } @@ -51,7 +51,7 @@ XmlElementTest::testNumericContentConstructor() void XmlElementTest::testSetName() { - CppUnit::XmlElement element( "aName" ); + CPPUNIT_NS::XmlElement element( "aName" ); element.setName( "anotherName" ); CPPUNIT_ASSERT_EQUAL( std::string("anotherName"), element.name() ); } @@ -60,7 +60,7 @@ XmlElementTest::testSetName() void XmlElementTest::testSetStringContent() { - CppUnit::XmlElement element( "aName", "someContent" ); + CPPUNIT_NS::XmlElement element( "aName", "someContent" ); element.setContent( "other" ); CPPUNIT_ASSERT_EQUAL( std::string("other"), element.content() ); } @@ -69,7 +69,7 @@ XmlElementTest::testSetStringContent() void XmlElementTest::testSetNumericContent() { - CppUnit::XmlElement element( "aName", "someContent" ); + CPPUNIT_NS::XmlElement element( "aName", "someContent" ); element.setContent( 87654321 ); CPPUNIT_ASSERT_EQUAL( std::string("87654321"), element.content() ); } @@ -78,11 +78,11 @@ XmlElementTest::testSetNumericContent() void XmlElementTest::testElementCount() { - CppUnit::XmlElement node( "element", "content" ); + CPPUNIT_NS::XmlElement node( "element", "content" ); CPPUNIT_ASSERT_EQUAL( 0, node.elementCount() ); - node.addElement( new CppUnit::XmlElement( "child1" ) ); - node.addElement( new CppUnit::XmlElement( "child2" ) ); + node.addElement( new CPPUNIT_NS::XmlElement( "child1" ) ); + node.addElement( new CPPUNIT_NS::XmlElement( "child2" ) ); CPPUNIT_ASSERT_EQUAL( 2, node.elementCount() ); } @@ -90,7 +90,7 @@ XmlElementTest::testElementCount() void XmlElementTest::testElementAtNegativeIndexThrow() { - CppUnit::XmlElement node( "element" ); + CPPUNIT_NS::XmlElement node( "element" ); node.elementAt( -1 ); } @@ -98,7 +98,7 @@ XmlElementTest::testElementAtNegativeIndexThrow() void XmlElementTest::testElementAtTooLargeIndexThrow() { - CppUnit::XmlElement node( "element" ); + CPPUNIT_NS::XmlElement node( "element" ); node.elementAt( 0 ); } @@ -106,9 +106,9 @@ XmlElementTest::testElementAtTooLargeIndexThrow() void XmlElementTest::testElementAt() { - CppUnit::XmlElement node( "element" ); - CppUnit::XmlElement *element1 = new CppUnit::XmlElement( "element1" ); - CppUnit::XmlElement *element2 = new CppUnit::XmlElement( "element2" ); + CPPUNIT_NS::XmlElement node( "element" ); + CPPUNIT_NS::XmlElement *element1 = new CPPUNIT_NS::XmlElement( "element1" ); + CPPUNIT_NS::XmlElement *element2 = new CPPUNIT_NS::XmlElement( "element2" ); node.addElement( element1 ); node.addElement( element2 ); @@ -120,8 +120,8 @@ XmlElementTest::testElementAt() void XmlElementTest::testElementForThrow() { - CppUnit::XmlElement node( "element" ); - node.addElement( new CppUnit::XmlElement( "element1" ) ); + CPPUNIT_NS::XmlElement node( "element" ); + node.addElement( new CPPUNIT_NS::XmlElement( "element1" ) ); node.elementFor( "name2" ); } @@ -129,9 +129,9 @@ XmlElementTest::testElementForThrow() void XmlElementTest::testElementFor() { - CppUnit::XmlElement node( "element" ); - CppUnit::XmlElement *element1 = new CppUnit::XmlElement( "element1" ); - CppUnit::XmlElement *element2 = new CppUnit::XmlElement( "element2" ); + CPPUNIT_NS::XmlElement node( "element" ); + CPPUNIT_NS::XmlElement *element1 = new CPPUNIT_NS::XmlElement( "element1" ); + CPPUNIT_NS::XmlElement *element2 = new CPPUNIT_NS::XmlElement( "element2" ); node.addElement( element1 ); node.addElement( element2 ); @@ -143,7 +143,7 @@ XmlElementTest::testElementFor() void XmlElementTest::testEmptyNodeToString() { - CppUnit::XmlElement node( "element" ); + CPPUNIT_NS::XmlElement node( "element" ); std::string expectedXml = "<element></element>"; CPPUNITTEST_ASSERT_XML_EQUAL( expectedXml, node.toString() ); } @@ -152,7 +152,7 @@ XmlElementTest::testEmptyNodeToString() void XmlElementTest::testElementWithAttributesToString() { - CppUnit::XmlElement node( "element" ); + CPPUNIT_NS::XmlElement node( "element" ); node.addAttribute( "id", 17 ); node.addAttribute( "date-format", "iso-8901" ); std::string expectedXml = "<element id=\"17\" " @@ -165,7 +165,7 @@ XmlElementTest::testElementWithAttributesToString() void XmlElementTest::testEscapedAttributeValueToString() { - CppUnit::XmlElement node( "element" ); + CPPUNIT_NS::XmlElement node( "element" ); node.addAttribute( "escaped", "&<>\"'" ); std::string expectedXml = "<element escaped=\"" "&<>"'" @@ -177,7 +177,7 @@ XmlElementTest::testEscapedAttributeValueToString() void XmlElementTest::testElementToStringEscapeContent() { - CppUnit::XmlElement node( "element", "ChessTest<class Chess>" ); + CPPUNIT_NS::XmlElement node( "element", "ChessTest<class Chess>" ); std::string expectedXml = "<element>" "ChessTest<class Chess>" "</element>"; @@ -188,9 +188,9 @@ XmlElementTest::testElementToStringEscapeContent() void XmlElementTest::testElementWithChildrenToString() { - CppUnit::XmlElement node( "element" ); - node.addElement( new CppUnit::XmlElement( "child1" ) ); - node.addElement( new CppUnit::XmlElement( "child2" ) ); + CPPUNIT_NS::XmlElement node( "element" ); + node.addElement( new CPPUNIT_NS::XmlElement( "child1" ) ); + node.addElement( new CPPUNIT_NS::XmlElement( "child2" ) ); std::string expectedXml = "<element><child1></child1>" "<child2></child2></element>"; CPPUNITTEST_ASSERT_XML_EQUAL( expectedXml, node.toString() ); @@ -200,7 +200,7 @@ XmlElementTest::testElementWithChildrenToString() void XmlElementTest::testElementWithContentToString() { - CppUnit::XmlElement node( "element", "content\nline2" ); + CPPUNIT_NS::XmlElement node( "element", "content\nline2" ); std::string expectedXml = "<element>content\nline2</element>"; CPPUNITTEST_ASSERT_XML_EQUAL( expectedXml, node.toString() ); } @@ -209,7 +209,7 @@ XmlElementTest::testElementWithContentToString() void XmlElementTest::testElementWithNumericContentToString() { - CppUnit::XmlElement node( "element", 123456789 ); + CPPUNIT_NS::XmlElement node( "element", 123456789 ); std::string expectedXml = "<element>123456789</element>"; CPPUNITTEST_ASSERT_XML_EQUAL( expectedXml, node.toString() ); } @@ -218,8 +218,8 @@ XmlElementTest::testElementWithNumericContentToString() void XmlElementTest::testElementWithContentAndChildToString() { - CppUnit::XmlElement node( "element", "content" ); - node.addElement( new CppUnit::XmlElement( "child1" ) ); + CPPUNIT_NS::XmlElement node( "element", "content" ); + node.addElement( new CPPUNIT_NS::XmlElement( "child1" ) ); std::string expectedXml = "<element><child1></child1>content</element>"; CPPUNITTEST_ASSERT_XML_EQUAL( expectedXml, node.toString() ); } diff --git a/examples/cppunittest/XmlOutputterTest.cpp b/examples/cppunittest/XmlOutputterTest.cpp index 7e85191..486f00c 100644 --- a/examples/cppunittest/XmlOutputterTest.cpp +++ b/examples/cppunittest/XmlOutputterTest.cpp @@ -25,7 +25,7 @@ void XmlOutputterTest::setUp() { m_dummyTests.clear(); - m_result = new CppUnit::TestResultCollector(); + m_result = new CPPUNIT_NS::TestResultCollector(); } @@ -42,8 +42,8 @@ XmlOutputterTest::tearDown() void XmlOutputterTest::testWriteXmlResultWithNoTest() { - CppUnit::OStringStream stream; - CppUnit::XmlOutputter outputter( m_result, stream ); + CPPUNIT_NS::OStringStream stream; + CPPUNIT_NS::XmlOutputter outputter( m_result, stream ); outputter.write(); std::string actualXml = stream.str(); @@ -65,10 +65,10 @@ XmlOutputterTest::testWriteXmlResultWithNoTest() void XmlOutputterTest::testWriteXmlResultWithOneFailure() { - addTestFailure( "test1", "message failure1", CppUnit::SourceLine( "test.cpp", 3 ) ); + addTestFailure( "test1", "message failure1", CPPUNIT_NS::SourceLine( "test.cpp", 3 ) ); - CppUnit::OStringStream stream; - CppUnit::XmlOutputter outputter( m_result, stream ); + CPPUNIT_NS::OStringStream stream; + CPPUNIT_NS::XmlOutputter outputter( m_result, stream ); outputter.write(); std::string actualXml = stream.str(); @@ -102,8 +102,8 @@ XmlOutputterTest::testWriteXmlResultWithOneError() { addTestError( "test1", "message error1" ); - CppUnit::OStringStream stream; - CppUnit::XmlOutputter outputter( m_result, stream ); + CPPUNIT_NS::OStringStream stream; + CPPUNIT_NS::XmlOutputter outputter( m_result, stream ); outputter.write(); std::string actualXml = stream.str(); @@ -133,8 +133,8 @@ XmlOutputterTest::testWriteXmlResultWithOneSuccess() { addTest( "test1" ); - CppUnit::OStringStream stream; - CppUnit::XmlOutputter outputter( m_result, stream ); + CPPUNIT_NS::OStringStream stream; + CPPUNIT_NS::XmlOutputter outputter( m_result, stream ); outputter.write(); std::string actualXml = stream.str(); @@ -168,8 +168,8 @@ XmlOutputterTest::testWriteXmlResultWithThreeFailureTwoErrorsAndTwoSuccess() addTestError( "test6", "error2" ); addTest( "test7" ); - CppUnit::OStringStream stream; - CppUnit::XmlOutputter outputter( m_result, stream ); + CPPUNIT_NS::OStringStream stream; + CPPUNIT_NS::XmlOutputter outputter( m_result, stream ); outputter.write(); std::string actualXml = stream.str(); @@ -221,7 +221,7 @@ XmlOutputterTest::testWriteXmlResultWithThreeFailureTwoErrorsAndTwoSuccess() } -class XmlOutputterTest::MockHook : public CppUnit::XmlOutputterHook +class XmlOutputterTest::MockHook : public CPPUNIT_NS::XmlOutputterHook { public: MockHook( int &beginCalls, @@ -237,33 +237,33 @@ public: { } - void beginDocument( CppUnit::XmlDocument *document ) + void beginDocument( CPPUNIT_NS::XmlDocument *document ) { ++m_beginCalls; } - void endDocument( CppUnit::XmlDocument *document ) + void endDocument( CPPUNIT_NS::XmlDocument *document ) { ++m_endCalls; } - void failTestAdded( CppUnit::XmlDocument *document, - CppUnit::XmlElement *testElement, - CppUnit::Test *test, - CppUnit::TestFailure *failure ) + void failTestAdded( CPPUNIT_NS::XmlDocument *document, + CPPUNIT_NS::XmlElement *testElement, + CPPUNIT_NS::Test *test, + CPPUNIT_NS::TestFailure *failure ) { ++m_failedTestCalls; } - void successfulTestAdded( CppUnit::XmlDocument *document, - CppUnit::XmlElement *testElement, - CppUnit::Test *test ) + void successfulTestAdded( CPPUNIT_NS::XmlDocument *document, + CPPUNIT_NS::XmlElement *testElement, + CPPUNIT_NS::Test *test ) { ++m_successfulTestCalls; } - void statisticsAdded( CppUnit::XmlDocument *document, - CppUnit::XmlElement *statisticsElement ) + void statisticsAdded( CPPUNIT_NS::XmlDocument *document, + CPPUNIT_NS::XmlElement *statisticsElement ) { ++m_statisticsCalls; } @@ -289,8 +289,8 @@ XmlOutputterTest::testHook() addTestFailure( "testfail1", "assertion failed" ); addTestError( "testerror1", "exception" ); - CppUnit::OStringStream stream; - CppUnit::XmlOutputter outputter( m_result, stream ); + CPPUNIT_NS::OStringStream stream; + CPPUNIT_NS::XmlOutputter outputter( m_result, stream ); outputter.addHook( &hook ); outputter.write(); @@ -305,7 +305,7 @@ XmlOutputterTest::testHook() void XmlOutputterTest::addTest( std::string testName ) { - CppUnit::Test *test = makeDummyTest( testName ); + CPPUNIT_NS::Test *test = makeDummyTest( testName ); m_result->startTest( test ); m_result->endTest( test ); } @@ -314,41 +314,41 @@ XmlOutputterTest::addTest( std::string testName ) void XmlOutputterTest::addTestFailure( std::string testName, std::string message, - CppUnit::SourceLine sourceLine ) + CPPUNIT_NS::SourceLine sourceLine ) { - addGenericTestFailure( testName, CppUnit::Message(message), sourceLine, false ); + addGenericTestFailure( testName, CPPUNIT_NS::Message(message), sourceLine, false ); } void XmlOutputterTest::addTestError( std::string testName, std::string message, - CppUnit::SourceLine sourceLine ) + CPPUNIT_NS::SourceLine sourceLine ) { - addGenericTestFailure( testName, CppUnit::Message(message), sourceLine, true ); + addGenericTestFailure( testName, CPPUNIT_NS::Message(message), sourceLine, true ); } void XmlOutputterTest::addGenericTestFailure( std::string testName, - CppUnit::Message message, - CppUnit::SourceLine sourceLine, + CPPUNIT_NS::Message message, + CPPUNIT_NS::SourceLine sourceLine, bool isError ) { - CppUnit::Test *test = makeDummyTest( testName ); + CPPUNIT_NS::Test *test = makeDummyTest( testName ); m_result->startTest( test ); - CppUnit::TestFailure failure( test, - new CppUnit::Exception( message, sourceLine ), + CPPUNIT_NS::TestFailure failure( test, + new CPPUNIT_NS::Exception( message, sourceLine ), isError ); m_result->addFailure( failure ); m_result->endTest( test ); } -CppUnit::Test * +CPPUNIT_NS::Test * XmlOutputterTest::makeDummyTest( std::string testName ) { - CppUnit::Test *test = new CppUnit::TestCase( testName ); + CPPUNIT_NS::Test *test = new CPPUNIT_NS::TestCase( testName ); m_dummyTests.push_back( test ); return test; } diff --git a/examples/cppunittest/XmlOutputterTest.h b/examples/cppunittest/XmlOutputterTest.h index a1600ee..c451a2b 100644 --- a/examples/cppunittest/XmlOutputterTest.h +++ b/examples/cppunittest/XmlOutputterTest.h @@ -11,7 +11,7 @@ /*! \class XmlOutputterTest * \brief Unit tests for XmlOutputter. */ -class XmlOutputterTest : public CppUnit::TestFixture +class XmlOutputterTest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( XmlOutputterTest ); CPPUNIT_TEST( testWriteXmlResultWithNoTest ); @@ -57,20 +57,20 @@ private: void addTest( std::string testName ); void addTestFailure( std::string testName, std::string message, - CppUnit::SourceLine sourceLine = CppUnit::SourceLine() ); + CPPUNIT_NS::SourceLine sourceLine = CPPUNIT_NS::SourceLine() ); void addTestError( std::string testName, std::string message, - CppUnit::SourceLine sourceLine = CppUnit::SourceLine() ); + CPPUNIT_NS::SourceLine sourceLine = CPPUNIT_NS::SourceLine() ); void addGenericTestFailure( std::string testName, - CppUnit::Message message, - CppUnit::SourceLine sourceLine, + CPPUNIT_NS::Message message, + CPPUNIT_NS::SourceLine sourceLine, bool isError ); - CppUnit::Test *makeDummyTest( std::string testName ); + CPPUNIT_NS::Test *makeDummyTest( std::string testName ); private: - CppUnit::TestResultCollector *m_result; - std::deque<CppUnit::Test *> m_dummyTests; + CPPUNIT_NS::TestResultCollector *m_result; + std::deque<CPPUNIT_NS::Test *> m_dummyTests; }; diff --git a/examples/cppunittest/XmlUniformiser.cpp b/examples/cppunittest/XmlUniformiser.cpp index 109a843..e884e20 100644 --- a/examples/cppunittest/XmlUniformiser.cpp +++ b/examples/cppunittest/XmlUniformiser.cpp @@ -23,7 +23,7 @@ notEqualIndex( std::string expectedXml, void checkXmlEqual( std::string expectedXml, std::string actualXml, - CppUnit::SourceLine sourceLine ) + CPPUNIT_NS::SourceLine sourceLine ) { std::string expected = XmlUniformiser( expectedXml ).stripped(); std::string actual = XmlUniformiser( actualXml ).stripped(); @@ -32,11 +32,11 @@ checkXmlEqual( std::string expectedXml, return; int index = notEqualIndex( expected, actual ); - CppUnit::OStringStream message; + CPPUNIT_NS::OStringStream message; message << "differ at index: " << index << "\n" << "expected: " << expected.substr(index) << "\n" << "but was : " << actual.substr( index ); - ::CppUnit::Asserter::failNotEqual( expected, + ::CPPUNIT_NS::Asserter::failNotEqual( expected, actual, sourceLine, message.str() ); diff --git a/examples/cppunittest/XmlUniformiserTest.h b/examples/cppunittest/XmlUniformiserTest.h index d590505..a7edf8c 100644 --- a/examples/cppunittest/XmlUniformiserTest.h +++ b/examples/cppunittest/XmlUniformiserTest.h @@ -7,7 +7,7 @@ /*! \class XmlUniformiserTest * \brief Unit test for XmlUniformiser. */ -class XmlUniformiserTest : public CppUnit::TestFixture +class XmlUniformiserTest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( XmlUniformiserTest ); CPPUNIT_TEST( testEmpty ); diff --git a/examples/examples.opt b/examples/examples.opt Binary files differindex 0e45e32..ecb0740 100644 --- a/examples/examples.opt +++ b/examples/examples.opt diff --git a/include/cppunit/Asserter.h b/include/cppunit/Asserter.h index 5a10236..8ad783d 100644 --- a/include/cppunit/Asserter.h +++ b/include/cppunit/Asserter.h @@ -42,18 +42,18 @@ class Message; * CPPUNIT_SOURCELINE() ) * \endcode */ -namespace Asserter +struct Asserter { /*! Throws a Exception with the specified message and location. */ - void CPPUNIT_API fail( const Message &message, - const SourceLine &sourceLine = SourceLine() ); + static void CPPUNIT_API fail( const Message &message, + const SourceLine &sourceLine = SourceLine() ); /*! Throws a Exception with the specified message and location. * \deprecated Use fail( Message, SourceLine ) instead. */ - void CPPUNIT_API fail( std::string message, - const SourceLine &sourceLine = SourceLine() ); + static void CPPUNIT_API fail( std::string message, + const SourceLine &sourceLine = SourceLine() ); /*! Throws a Exception with the specified message and location. * \param shouldFail if \c true then the exception is thrown. Otherwise @@ -61,9 +61,9 @@ namespace Asserter * \param message Message explaining the assertion failiure. * \param sourceLine Location of the assertion. */ - void CPPUNIT_API failIf( bool shouldFail, - const Message &message, - const SourceLine &sourceLine = SourceLine() ); + static void CPPUNIT_API failIf( bool shouldFail, + const Message &message, + const SourceLine &sourceLine = SourceLine() ); /*! Throws a Exception with the specified message and location. * \deprecated Use failIf( bool, Message, SourceLine ) instead. @@ -72,9 +72,9 @@ namespace Asserter * \param message Message explaining the assertion failiure. * \param sourceLine Location of the assertion. */ - void CPPUNIT_API failIf( bool shouldFail, - std::string message, - const SourceLine &sourceLine = SourceLine() ); + static void CPPUNIT_API failIf( bool shouldFail, + std::string message, + const SourceLine &sourceLine = SourceLine() ); /*! \brief Returns a expected value string for a message. * Typically used to create 'not equal' message, or to check that a message @@ -85,7 +85,7 @@ namespace Asserter * \return \a expectedValue prefixed with "Expected: ". * \see makeActual(). */ - std::string CPPUNIT_API makeExpected( const std::string &expectedValue ); + static std::string CPPUNIT_API makeExpected( const std::string &expectedValue ); /*! \brief Returns an actual value string for a message. * Typically used to create 'not equal' message, or to check that a message @@ -96,12 +96,12 @@ namespace Asserter * \return \a actualValue prefixed with "Actual : ". * \see makeExpected(). */ - std::string CPPUNIT_API makeActual( const std::string &actualValue ); + static std::string CPPUNIT_API makeActual( const std::string &actualValue ); - Message CPPUNIT_API makeNotEqualMessage( const std::string &expectedValue, - const std::string &actualValue, - const AdditionalMessage &additionalMessage = AdditionalMessage(), - const std::string &shortDescription = "equality assertion failed"); + static Message CPPUNIT_API makeNotEqualMessage( const std::string &expectedValue, + const std::string &actualValue, + const AdditionalMessage &additionalMessage = AdditionalMessage(), + const std::string &shortDescription = "equality assertion failed"); /*! Throws an Exception with the specified message and location. * \param expected Text describing the expected value. @@ -110,11 +110,11 @@ namespace Asserter * what are the differences between the expected and actual value. * \param sourceLine Location of the assertion. */ - void CPPUNIT_API failNotEqual( std::string expected, - std::string actual, - const SourceLine &sourceLine, - const AdditionalMessage &additionalMessage = AdditionalMessage(), - std::string shortDescription = "equality assertion failed" ); + static void CPPUNIT_API failNotEqual( std::string expected, + std::string actual, + const SourceLine &sourceLine, + const AdditionalMessage &additionalMessage = AdditionalMessage(), + std::string shortDescription = "equality assertion failed" ); /*! Throws an Exception with the specified message and location. * \param shouldFail if \c true then the exception is thrown. Otherwise @@ -125,14 +125,14 @@ namespace Asserter * where the "difference" is located. * \param sourceLine Location of the assertion. */ - void CPPUNIT_API failNotEqualIf( bool shouldFail, - std::string expected, - std::string actual, - const SourceLine &sourceLine, - const AdditionalMessage &additionalMessage = AdditionalMessage(), - std::string shortDescription = "equality assertion failed" ); - -} // namespace Asserter + static void CPPUNIT_API failNotEqualIf( bool shouldFail, + std::string expected, + std::string actual, + const SourceLine &sourceLine, + const AdditionalMessage &additionalMessage = AdditionalMessage(), + std::string shortDescription = "equality assertion failed" ); + +}; CPPUNIT_NS_END diff --git a/include/cppunit/CompilerOutputter.h b/include/cppunit/CompilerOutputter.h index 1660887..04be58f 100644 --- a/include/cppunit/CompilerOutputter.h +++ b/include/cppunit/CompilerOutputter.h @@ -3,7 +3,6 @@ #include <cppunit/Portability.h> #include <cppunit/Outputter.h> -#include <vector> #include <iostream> CPPUNIT_NS_BEGIN diff --git a/include/cppunit/Message.h b/include/cppunit/Message.h index e3d8639..80c7cdb 100644 --- a/include/cppunit/Message.h +++ b/include/cppunit/Message.h @@ -8,7 +8,7 @@ #pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z #endif -#include <deque> +#include <cppunit/portability/CppUnitDeque.h> #include <string> @@ -137,7 +137,7 @@ public: private: std::string m_shortDescription; - typedef std::deque<std::string> Details; + typedef CppUnitDeque<std::string> Details; Details m_details; }; diff --git a/include/cppunit/Portability.h b/include/cppunit/Portability.h index 70f9e05..ce7ebea 100644 --- a/include/cppunit/Portability.h +++ b/include/cppunit/Portability.h @@ -26,67 +26,81 @@ /* Define to 1 if you wish to have the old-style macros assert(), assertEqual(), assertDoublesEqual(), and assertLongsEqual() */ -#ifndef CPPUNIT_ENABLE_NAKED_ASSERT -#define CPPUNIT_ENABLE_NAKED_ASSERT 0 +#if !defined(CPPUNIT_ENABLE_NAKED_ASSERT) +# define CPPUNIT_ENABLE_NAKED_ASSERT 0 #endif /* Define to 1 if you wish to have the old-style CU_TEST family of macros. */ -#ifndef CPPUNIT_ENABLE_CU_TEST_MACROS -#define CPPUNIT_ENABLE_CU_TEST_MACROS 0 +#if !defined(CPPUNIT_ENABLE_CU_TEST_MACROS) +# define CPPUNIT_ENABLE_CU_TEST_MACROS 0 #endif /* Define to 1 if the preprocessor expands (#foo) to "foo" (quotes incl.) I don't think there is any C preprocess that does NOT support this! */ -#ifndef CPPUNIT_HAVE_CPP_SOURCE_ANNOTATION -#define CPPUNIT_HAVE_CPP_SOURCE_ANNOTATION 1 +#if !defined(CPPUNIT_HAVE_CPP_SOURCE_ANNOTATION) +# define CPPUNIT_HAVE_CPP_SOURCE_ANNOTATION 1 #endif /* Assumes that STL and CppUnit are in global space if the compiler does not support namespace. */ #if !defined(CPPUNIT_HAVE_NAMESPACES) -#ifndef CPPUNIT_NO_NAMESPACE -#define CPPUNIT_NO_NAMESPACE 1 -#endif // CPPUNIT_NO_NAMESPACE -#ifndef CPPUNIT_NO_STD_NAMESPACE -#define CPPUNIT_NO_STD_NAMESPACE 1 -#endif // CPPUNIT_NO_STD_NAMESPACE +# if !defined(CPPUNIT_NO_NAMESPACE) +# define CPPUNIT_NO_NAMESPACE 1 +# endif // !defined(CPPUNIT_NO_NAMESPACE) +# if !defined(CPPUNIT_NO_STD_NAMESPACE) +# define CPPUNIT_NO_STD_NAMESPACE 1 +# endif // !defined(CPPUNIT_NO_STD_NAMESPACE) #endif // !defined(CPPUNIT_HAVE_NAMESPACES) +/* Define CPPUNIT_STD_NEED_ALLOCATOR to 1 if you need to specify + * the allocator you used when instantiating STL container. Typically + * used for compilers that do not support template default parameter. + * CPPUNIT_STD_ALLOCATOR will be used as the allocator. Default is + * std::allocator. On some compilers, you may need to change this to + * std::allocator<T>. + */ +#if CPPUNIT_STD_NEED_ALLOCATOR +# if !defined(CPPUNIT_STD_ALLOCATOR) +# define CPPUNIT_STD_ALLOCATOR std::allocator +# endif // !defined(CPPUNIT_STD_ALLOCATOR) +#endif // defined(CPPUNIT_STD_NEED_ALLOCATOR) + + // Compiler error location format for CompilerOutputter // If not define, assumes that it's gcc // See class CompilerOutputter for format. -#ifndef CPPUNIT_COMPILER_LOCATION_FORMAT -#define CPPUNIT_COMPILER_LOCATION_FORMAT "%f:%l:" +#if !defined(CPPUNIT_COMPILER_LOCATION_FORMAT) +# define CPPUNIT_COMPILER_LOCATION_FORMAT "%f:%l:" #endif // If CPPUNIT_HAVE_CPP_CAST is defined, then c++ style cast will be used, // otherwise, C style cast are used. #if defined( CPPUNIT_HAVE_CPP_CAST ) -#define CPPUNIT_CONST_CAST( TargetType, pointer ) \ +# define CPPUNIT_CONST_CAST( TargetType, pointer ) \ const_cast<TargetType>( pointer ) -#else -#define CPPUNIT_CONST_CAST( TargetType, pointer ) \ +#else // defined( CPPUNIT_HAVE_CPP_CAST ) +# define CPPUNIT_CONST_CAST( TargetType, pointer ) \ ((TargetType)( pointer )) -#endif +#endif // defined( CPPUNIT_HAVE_CPP_CAST ) // If CPPUNIT_NO_STD_NAMESPACE is defined then STL are in the global space. // => Define macro 'std' to nothing #if defined(CPPUNIT_NO_STD_NAMESPACE) -#undef std -#define std +# undef std +# define std #endif // defined(CPPUNIT_NO_STD_NAMESPACE) // If CPPUNIT_NO_NAMESPACE is defined, then put CppUnit classes in the // global namespace: the compiler does not support namespace. #if defined(CPPUNIT_NO_NAMESPACE) -#define CPPUNIT_NS_BEGIN -#define CPPUNIT_NS_END -#define CPPUNIT_NS(symbol) symbol +# define CPPUNIT_NS_BEGIN +# define CPPUNIT_NS_END +# define CPPUNIT_NS #else // defined(CPPUNIT_NO_NAMESPACE) -#define CPPUNIT_NS_BEGIN namespace CppUnit { -#define CPPUNIT_NS_END } -#define CPPUNIT_NS(symbol) ::CppUnit::symbol +# define CPPUNIT_NS_BEGIN namespace CppUnit { +# define CPPUNIT_NS_END } +# define CPPUNIT_NS CppUnit #endif // defined(CPPUNIT_NO_NAMESPACE) /*! Stringize a symbol. @@ -138,8 +152,8 @@ /*! Defines wrap colunm for %CppUnit. Used by CompilerOuputter. */ -#ifndef CPPUNIT_WRAP_COLUMN -#define CPPUNIT_WRAP_COLUMN 79 +#if !defined(CPPUNIT_WRAP_COLUMN) +# define CPPUNIT_WRAP_COLUMN 79 #endif @@ -150,38 +164,41 @@ * method. */ #if CPPUNIT_HAVE_SSTREAM -# include <sstream> - namespace CppUnit { - class OStringStream : public std::ostringstream - { - }; - } -#else -#if CPPUNIT_HAVE_CLASS_STRSTREAM -# include <string> -# if CPPUNIT_HAVE_STRSTREAM -# include <strstream> -# else -# include <strstream.h> -# endif - - namespace CppUnit { +# include <sstream> + CPPUNIT_NS_BEGIN + + typedef std::ostringstream OStringStream; + + CPPUNIT_NS_END +#elif CPPUNIT_HAVE_CLASS_STRSTREAM +# include <string> +# if CPPUNIT_HAVE_STRSTREAM +# include <strstream> +# else // CPPUNIT_HAVE_STRSTREAM +# include <strstream.h> +# endif // CPPUNIT_HAVE_CLASS_STRSTREAM + + CPPUNIT_NS_BEGIN + class OStringStream : public std::ostrstream { public: std::string str() { - (*this) << '\0'; - std::string msg(std::ostrstream::str()); - std::ostrstream::freeze(false); - return msg; +// (*this) << '\0'; +// std::string msg(std::ostrstream::str()); +// std::ostrstream::freeze(false); +// return msg; +// Alternative implementation that don't rely on freeze which is not +// available on some platforms: + return std::string( std::ostrstream::str(), pcount() ); } }; - } -#else + + CPPUNIT_NS_END +#else // CPPUNIT_HAVE_CLASS_STRSTREAM # error Cannot define CppUnit::OStringStream. -#endif -#endif +#endif // CPPUNIT_HAVE_SSTREAM #endif // CPPUNIT_PORTABILITY_H diff --git a/include/cppunit/SourceLine.h b/include/cppunit/SourceLine.h index bb538cc..71eeaed 100644 --- a/include/cppunit/SourceLine.h +++ b/include/cppunit/SourceLine.h @@ -10,7 +10,7 @@ * Used to write your own assertion macros. * \see Asserter for example of usage. */ -#define CPPUNIT_SOURCELINE() CPPUNIT_NS(SourceLine)( __FILE__, __LINE__ ) +#define CPPUNIT_SOURCELINE() CPPUNIT_NS::SourceLine( __FILE__, __LINE__ ) CPPUNIT_NS_BEGIN diff --git a/include/cppunit/TestAssert.h b/include/cppunit/TestAssert.h index e726d40..ba30e9c 100644 --- a/include/cppunit/TestAssert.h +++ b/include/cppunit/TestAssert.h @@ -120,14 +120,14 @@ namespace TestAssert * \ingroup Assertions */ #define CPPUNIT_ASSERT(condition) \ - ( CPPUNIT_NS(Asserter)::failIf( !(condition), \ - CPPUNIT_NS(Message)( "assertion failed", \ + ( CPPUNIT_NS::Asserter::failIf( !(condition), \ + CPPUNIT_NS::Message( "assertion failed", \ "Expression: " #condition), \ CPPUNIT_SOURCELINE() ) ) #else #define CPPUNIT_ASSERT(condition) \ - ( CPPUNIT_NS(Asserter)::failIf( !(condition), \ - CPPUNIT_NS(Message)( "assertion failed" ), \ + ( CPPUNIT_NS::Asserter::failIf( !(condition), \ + CPPUNIT_NS::Message( "assertion failed" ), \ CPPUNIT_SOURCELINE() ) ) #endif @@ -139,7 +139,7 @@ namespace TestAssert * test failed. */ #define CPPUNIT_ASSERT_MESSAGE(message,condition) \ - ( CPPUNIT_NS(Asserter)::failIf( !(condition), \ + ( CPPUNIT_NS::Asserter::failIf( !(condition), \ (message), \ CPPUNIT_SOURCELINE() ) ) @@ -148,14 +148,14 @@ namespace TestAssert * \param message Message reported in diagnostic. */ #define CPPUNIT_FAIL( message ) \ - ( CPPUNIT_NS(Asserter)::fail( CPPUNIT_NS(Message)( "forced failure", \ + ( CPPUNIT_NS::Asserter::fail( CPPUNIT_NS::Message( "forced failure", \ message ), \ CPPUNIT_SOURCELINE() ) ) #ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED /// Generalized macro for primitive value comparisons #define CPPUNIT_ASSERT_EQUAL(expected,actual) \ - ( CPPUNIT_NS(TestAssert)::assertEquals( (expected), \ + ( CPPUNIT_NS::TestAssert::assertEquals( (expected), \ (actual), \ __LINE__, __FILE__ ) ) #else @@ -176,7 +176,7 @@ namespace TestAssert * removed by specializing the CppUnit::assertion_traits. */ #define CPPUNIT_ASSERT_EQUAL(expected,actual) \ - ( CPPUNIT_NS(TestAssert)::assertEquals( (expected), \ + ( CPPUNIT_NS::TestAssert::assertEquals( (expected), \ (actual), \ CPPUNIT_SOURCELINE() ) ) @@ -199,7 +199,7 @@ namespace TestAssert * removed by specializing the CppUnit::assertion_traits. */ #define CPPUNIT_ASSERT_EQUAL_MESSAGE(message,expected,actual) \ - ( CPPUNIT_NS(TestAssert)::assertEquals( (expected), \ + ( CPPUNIT_NS::TestAssert::assertEquals( (expected), \ (actual), \ CPPUNIT_SOURCELINE(), \ (message) ) ) @@ -209,7 +209,7 @@ namespace TestAssert * \ingroup Assertions */ #define CPPUNIT_ASSERT_DOUBLES_EQUAL(expected,actual,delta) \ - ( CPPUNIT_NS(TestAssert)::assertDoubleEquals( (expected), \ + ( CPPUNIT_NS::TestAssert::assertDoubleEquals( (expected), \ (actual), \ (delta), \ CPPUNIT_SOURCELINE() ) ) diff --git a/include/cppunit/TestPath.h b/include/cppunit/TestPath.h index 65f974c..63dbae4 100644 --- a/include/cppunit/TestPath.h +++ b/include/cppunit/TestPath.h @@ -8,7 +8,7 @@ #pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z #endif -#include <deque> +#include <cppunit/portability/CppUnitDeque.h> CPPUNIT_NS_BEGIN @@ -173,7 +173,7 @@ protected: void checkIndexValid( int index ) const; /// A list of test names. - typedef std::deque<std::string> PathTestNames; + typedef CppUnitDeque<std::string> PathTestNames; /*! Splits a path string into its test name components. * \param pathAsString Path string created with toString(). @@ -198,7 +198,7 @@ protected: PathTestNames &testNames ); protected: - typedef std::deque<Test *> Tests; + typedef CppUnitDeque<Test *> Tests; Tests m_tests; }; diff --git a/include/cppunit/TestResult.h b/include/cppunit/TestResult.h index faed1dc..c859001 100644 --- a/include/cppunit/TestResult.h +++ b/include/cppunit/TestResult.h @@ -9,7 +9,7 @@ #endif #include <cppunit/SynchronizedObject.h> -#include <deque> +#include <cppunit/portability/CppUnitDeque.h> CPPUNIT_NS_BEGIN @@ -74,7 +74,7 @@ protected: virtual void endTestRun( Test *test ); protected: - typedef std::deque<TestListener *> TestListeners; + typedef CppUnitDeque<TestListener *> TestListeners; TestListeners m_listeners; bool m_stop; diff --git a/include/cppunit/TestResultCollector.h b/include/cppunit/TestResultCollector.h index 8465297..65b77cd 100644 --- a/include/cppunit/TestResultCollector.h +++ b/include/cppunit/TestResultCollector.h @@ -9,7 +9,7 @@ #endif #include <cppunit/TestSuccessListener.h> -#include <deque> +#include <cppunit/portability/CppUnitDeque.h> CPPUNIT_NS_BEGIN @@ -36,8 +36,8 @@ CPPUNIT_NS_BEGIN class CPPUNIT_API TestResultCollector : public TestSuccessListener { public: - typedef std::deque<TestFailure *> TestFailures; - typedef std::deque<Test *> Tests; + typedef CppUnitDeque<TestFailure *> TestFailures; + typedef CppUnitDeque<Test *> Tests; /*! Constructs a TestResultCollector object. diff --git a/include/cppunit/TestRunner.h b/include/cppunit/TestRunner.h index 3a853e9..50390f0 100644 --- a/include/cppunit/TestRunner.h +++ b/include/cppunit/TestRunner.h @@ -95,6 +95,8 @@ public: const std::string &testPath = "" ); protected: + /*! \brief (INTERNAL) Mutating test suite. + */ class CPPUNIT_API WrappingSuite : public TestSuite { public: diff --git a/include/cppunit/TestSuite.h b/include/cppunit/TestSuite.h index 7abea67..a478b8d 100644 --- a/include/cppunit/TestSuite.h +++ b/include/cppunit/TestSuite.h @@ -9,7 +9,7 @@ #endif #include <cppunit/TestComposite.h> -#include <vector> +#include <cppunit/portability/CppUnitVector.h> CPPUNIT_NS_BEGIN @@ -56,7 +56,7 @@ public: * TestComposite interface instead. * \return Reference on a vector that contains the tests of the suite. */ - const std::vector<Test *> &getTests() const; + const CppUnitVector<Test *> &getTests() const; /*! Destroys all the tests of the suite. */ @@ -67,7 +67,7 @@ public: Test *doGetChildTestAt( int index ) const; private: - std::vector<Test *> m_tests; + CppUnitVector<Test *> m_tests; }; diff --git a/include/cppunit/TextTestRunner.h b/include/cppunit/TextTestRunner.h index 417dfab..28c2513 100644 --- a/include/cppunit/TextTestRunner.h +++ b/include/cppunit/TextTestRunner.h @@ -1,18 +1,20 @@ #ifndef CPPUNIT_TEXTTESTRUNNER_H #define CPPUNIT_TEXTTESTRUNNER_H -#include <cppunit/ui/text/TestRunner.h> +#include <cppunit/ui/text/TextTestRunner.h> -CPPUNIT_NS_BEGIN +#if !defined(CPPUNIT_NO_NAMESPACE) +namespace TextUi +{ -/*! - * \brief A text mode test runner. - * \ingroup ExecutingTest - * \deprecated Use CppUnit::TextUi::TestRunner instead. - */ -typedef CPPUNIT_NS(TextUi::TestRunner) TextTestRunner; + /*! Text TestRunner (DEPRECATED). + * \deprecated Use TextTestRunner instead. + */ + typedef TextTestRunner TestRunner; + +} +#endif -CPPUNIT_NS_END #endif // CPPUNIT_TEXTTESTRUNNER_H diff --git a/include/cppunit/XmlOutputter.h b/include/cppunit/XmlOutputter.h index 3b733ac..b28b727 100644 --- a/include/cppunit/XmlOutputter.h +++ b/include/cppunit/XmlOutputter.h @@ -9,7 +9,7 @@ #endif #include <cppunit/Outputter.h> -#include <deque> +#include <cppunit/portability/CppUnitDeque.h> #include <iostream> #include <map> @@ -128,7 +128,7 @@ protected: virtual void fillFailedTestsMap( FailedTests &failedTests ); protected: - typedef std::deque<XmlOutputterHook *> Hooks; + typedef CppUnitDeque<XmlOutputterHook *> Hooks; TestResultCollector *m_result; std::ostream &m_stream; diff --git a/include/cppunit/config/config-msvc6.h b/include/cppunit/config/config-msvc6.h index 32a9e26..eea5cf6 100644 --- a/include/cppunit/config/config-msvc6.h +++ b/include/cppunit/config/config-msvc6.h @@ -53,6 +53,12 @@ #undef CPPUNIT_COMPILER_LOCATION_FORMAT #define CPPUNIT_COMPILER_LOCATION_FORMAT "%p(%l):" - +// Uncomment to turn on STL wrapping => use this to test compilation. +// This will make CppUnit subclass std::vector & co to provide default +// parameter. +#define CPPUNIT_STD_NEED_ALLOCATOR 1 +#define CPPUNIT_STD_ALLOCATOR std::allocator<T> + + /* _INCLUDE_CPPUNIT_CONFIG_MSVC6_H */ #endif diff --git a/include/cppunit/extensions/AutoRegisterSuite.h b/include/cppunit/extensions/AutoRegisterSuite.h index b690801..e04adb5 100644 --- a/include/cppunit/extensions/AutoRegisterSuite.h +++ b/include/cppunit/extensions/AutoRegisterSuite.h @@ -8,7 +8,7 @@ CPPUNIT_NS_BEGIN -/** Automatically register the test suite of the specified type. (Implementation) +/*! \brief (Implementation) Automatically register the test suite of the specified type. * * You should not use this class directly. Instead, use the following macros: * - CPPUNIT_TEST_SUITE_REGISTRATION() @@ -57,7 +57,7 @@ private: }; -/*! Automatically adds a registry into another registry. (Implementation) +/*! \brief (Implementation) Automatically adds a registry into another registry. * * Don't use this class. Use the macros CPPUNIT_REGISTRY_ADD() and * CPPUNIT_REGISTRY_ADD_TO_DEFAULT() instead. diff --git a/include/cppunit/extensions/HelperMacros.h b/include/cppunit/extensions/HelperMacros.h index 5d63f8b..379187f 100644 --- a/include/cppunit/extensions/HelperMacros.h +++ b/include/cppunit/extensions/HelperMacros.h @@ -22,7 +22,7 @@ CPPUNIT_NS_BEGIN { public: //! Creates a new TestFixture instance. - virtual CPPUNIT_NS(TestFixture) *makeFixture() =0; + virtual CPPUNIT_NS::TestFixture *makeFixture() =0; }; CPPUNIT_NS_END @@ -114,14 +114,14 @@ CPPUNIT_NS_END #define CPPUNIT_TEST_SUITE( ATestFixtureType ) \ private: \ typedef ATestFixtureType ThisTestFixtureType; \ - class __ThisTestFixtureFactory : public CPPUNIT_NS(TestFixtureFactory) \ + class __ThisTestFixtureFactory : public CPPUNIT_NS::TestFixtureFactory \ { \ - virtual CPPUNIT_NS(TestFixture) *makeFixture() \ + virtual CPPUNIT_NS::TestFixture *makeFixture() \ { \ return new ATestFixtureType(); \ } \ }; \ - static const CPPUNIT_NS(TestNamer) &__getTestNamer() \ + static const CPPUNIT_NS::TestNamer &__getTestNamer() \ { \ static CPPUNIT_TESTNAMER_DECL( testNamer, ATestFixtureType ); \ return testNamer; \ @@ -130,7 +130,7 @@ CPPUNIT_NS_END class ThisTestFixtureFactory \ { \ public: \ - ThisTestFixtureFactory( CPPUNIT_NS(TestFixtureFactory) *factory ) \ + ThisTestFixtureFactory( CPPUNIT_NS::TestFixtureFactory *factory ) \ : m_factory( factory ) \ { \ } \ @@ -139,16 +139,16 @@ CPPUNIT_NS_END return (ThisTestFixtureType *)m_factory->makeFixture(); \ } \ private: \ - CPPUNIT_NS(TestFixtureFactory) *m_factory; \ + CPPUNIT_NS::TestFixtureFactory *m_factory; \ }; \ \ static void \ - __registerTests( CPPUNIT_NS(TestSuite) *suite, \ - CPPUNIT_NS(TestFixtureFactory) *fixtureFactory, \ - const CPPUNIT_NS(TestNamer) &namer ) \ + __registerTests( CPPUNIT_NS::TestSuite *suite, \ + CPPUNIT_NS::TestFixtureFactory *fixtureFactory, \ + const CPPUNIT_NS::TestNamer &namer ) \ { \ const ThisTestFixtureFactory factory( fixtureFactory ); \ - CPPUNIT_NS(TestSuiteBuilder)<ThisTestFixtureType> builder( suite, namer ) + CPPUNIT_NS::TestSuiteBuilder<ThisTestFixtureType> builder( suite, namer ) /*! \brief Begin test suite (includes parent suite) @@ -272,7 +272,7 @@ CPPUNIT_NS_END * method. */ #define CPPUNIT_TEST_EXCEPTION( testMethod, ExceptionType ) \ - CPPUNIT_TEST_ADD( (new CPPUNIT_NS(TestCaller)<ThisTestFixtureType, \ + CPPUNIT_TEST_ADD( (new CPPUNIT_NS::TestCaller<ThisTestFixtureType, \ ExceptionType>( \ namer.getTestNameFor( #testMethod ), \ &ThisTestFixtureType::testMethod, \ @@ -294,7 +294,7 @@ CPPUNIT_NS_END * \see CreatingNewAssertions. */ #define CPPUNIT_TEST_FAIL( testMethod ) \ - CPPUNIT_TEST_EXCEPTION( testMethod, CPPUNIT_NS(Exception) ) + CPPUNIT_TEST_EXCEPTION( testMethod, CPPUNIT_NS::Exception ) /*! \brief Adds a custom test case. * @@ -398,10 +398,10 @@ CPPUNIT_NS_END #define CPPUNIT_TEST_SUITE_END() \ builder.takeSuite(); \ } \ - static CPPUNIT_NS(TestSuite) *suite() \ + static CPPUNIT_NS::TestSuite *suite() \ { \ - const CPPUNIT_NS(TestNamer) &namer = __getTestNamer(); \ - CPPUNIT_NS(TestSuiteBuilder)<ThisTestFixtureType> builder( namer ); \ + const CPPUNIT_NS::TestNamer &namer = __getTestNamer(); \ + CPPUNIT_NS::TestSuiteBuilder<ThisTestFixtureType> builder( namer ); \ __ThisTestFixtureFactory factory; \ ThisTestFixtureType::__registerTests( builder.suite(), &factory, namer ); \ return builder.takeSuite(); \ @@ -431,7 +431,7 @@ CPPUNIT_NS_END * CppUnit::TestFactoryRegistry. */ #define CPPUNIT_TEST_SUITE_REGISTRATION( ATestFixtureType ) \ - static CPPUNIT_NS(AutoRegisterSuite)< ATestFixtureType > \ + static CPPUNIT_NS::AutoRegisterSuite< ATestFixtureType > \ CPPUNIT_MAKE_UNIQUE_NAME(__autoRegisterSuite ) @@ -473,7 +473,7 @@ CPPUNIT_NS_END * CppUnit::TestFactoryRegistry.. */ #define CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ATestFixtureType, suiteName ) \ - static CPPUNIT_NS(AutoRegisterSuite)< ATestFixtureType > \ + static CPPUNIT_NS::AutoRegisterSuite< ATestFixtureType > \ CPPUNIT_MAKE_UNIQUE_NAME(__autoRegisterSuite )(suiteName) /*! Adds that the specified registry suite to another registry suite. @@ -504,7 +504,7 @@ CPPUNIT_NS_END * \see CPPUNIT_REGISTRY_ADD_TO_DEFAULT, CPPUNIT_TEST_SUITE_NAMED_REGISTRATION. */ #define CPPUNIT_REGISTRY_ADD( which, to ) \ - static CPPUNIT_NS(AutoRegisterRegistry) \ + static CPPUNIT_NS::AutoRegisterRegistry \ CPPUNIT_MAKE_UNIQUE_NAME( __autoRegisterRegistry )( which, to ) /*! Adds that the specified registry suite to the default registry suite. @@ -517,7 +517,7 @@ CPPUNIT_NS_END * \see CPPUNIT_REGISTRY_ADD. */ #define CPPUNIT_REGISTRY_ADD_TO_DEFAULT( which ) \ - static CPPUNIT_NS(AutoRegisterRegistry) \ + static CPPUNIT_NS::AutoRegisterRegistry \ CPPUNIT_MAKE_UNIQUE_NAME( __autoRegisterRegistry )( which ) // Backwards compatibility diff --git a/include/cppunit/extensions/TestNamer.h b/include/cppunit/extensions/TestNamer.h index 6267604..6d0e7f6 100644 --- a/include/cppunit/extensions/TestNamer.h +++ b/include/cppunit/extensions/TestNamer.h @@ -28,10 +28,10 @@ */ #if CPPUNIT_USE_TYPEINFO_NAME # define CPPUNIT_TESTNAMER_DECL( variableName, FixtureType ) \ - CPPUNIT_NS(TestNamer) variableName( typeid(FixtureType) ) + CPPUNIT_NS::TestNamer variableName( typeid(FixtureType) ) #else # define CPPUNIT_TESTNAMER_DECL( variableName, FixtureType ) \ - CPPUNIT_NS(TestNamer) variableName( std::string(#FixtureType) ) + CPPUNIT_NS::TestNamer variableName( std::string(#FixtureType) ) #endif diff --git a/include/cppunit/extensions/TestSetUp.h b/include/cppunit/extensions/TestSetUp.h index 3561262..f2128ec 100644 --- a/include/cppunit/extensions/TestSetUp.h +++ b/include/cppunit/extensions/TestSetUp.h @@ -9,7 +9,8 @@ CPPUNIT_NS_BEGIN class Test; class TestResult; - +/*! \brief Decorates a test by providing a specific setUp() and tearDown(). + */ class CPPUNIT_API TestSetUp : public TestDecorator { public: diff --git a/include/cppunit/plugin/Parameters.h b/include/cppunit/plugin/Parameters.h index 54a26d2..e914f3f 100644 --- a/include/cppunit/plugin/Parameters.h +++ b/include/cppunit/plugin/Parameters.h @@ -5,13 +5,13 @@ #if !defined(CPPUNIT_NO_TESTPLUGIN) -#include <deque> +#include <cppunit/portability/CppUnitDeque.h> #include <string> CPPUNIT_NS_BEGIN -typedef std::deque<std::string> Parameters; +typedef CppUnitDeque<std::string> Parameters; CPPUNIT_NS_END diff --git a/include/cppunit/plugin/PlugInManager.h b/include/cppunit/plugin/PlugInManager.h index 87455f0..585ac89 100644 --- a/include/cppunit/plugin/PlugInManager.h +++ b/include/cppunit/plugin/PlugInManager.h @@ -74,6 +74,8 @@ public: void removeXmlOutputterHooks(); protected: + /*! \brief (INTERNAL) Information about a specific plug-in. + */ struct PlugInInfo { std::string m_fileName; @@ -94,7 +96,7 @@ private: void operator =( const PlugInManager © ); private: - typedef std::deque<PlugInInfo> PlugIns; + typedef CppUnitDeque<PlugInInfo> PlugIns; PlugIns m_plugIns; }; diff --git a/include/cppunit/plugin/TestPlugIn.h b/include/cppunit/plugin/TestPlugIn.h index 568293e..d206d79 100644 --- a/include/cppunit/plugin/TestPlugIn.h +++ b/include/cppunit/plugin/TestPlugIn.h @@ -20,7 +20,7 @@ class XmlOutputter; */ -/*! Test plug-in interface. +/*! \brief Test plug-in interface. * \ingroup WritingTestPlugIn * * This class define the interface implemented by test plug-in. A pointer to that @@ -54,8 +54,8 @@ struct CppUnitTestPlugIn * N.B.: Parameters interface is not define yet, and the plug-in runner does * not yet support plug-in parameter. */ - virtual void initialize( CPPUNIT_NS(TestFactoryRegistry) *registry, - const CPPUNIT_NS(Parameters) ¶meters ) =0; + virtual void initialize( CPPUNIT_NS::TestFactoryRegistry *registry, + const CPPUNIT_NS::Parameters ¶meters ) =0; /*! Gives a chance to the plug-in to register TestListener. * @@ -64,17 +64,17 @@ struct CppUnitTestPlugIn * setUp some global resource: listen to TestListener::startTestRun(), * and TestListener::endTestRun(). */ - virtual void addListener( CPPUNIT_NS(TestResult) *eventManager ) =0; + virtual void addListener( CPPUNIT_NS::TestResult *eventManager ) =0; /*! Gives a chance to the plug-in to remove its registered TestListener. * * Override this method to remove a TestListener that has been added. */ - virtual void removeListener( CPPUNIT_NS(TestResult) *eventManager ) =0; + virtual void removeListener( CPPUNIT_NS::TestResult *eventManager ) =0; /*! Provides a way for the plug-in to register some XmlOutputterHook. */ - virtual void addXmlOutputterHooks( CPPUNIT_NS(XmlOutputter) *outputter ) =0; + virtual void addXmlOutputterHooks( CPPUNIT_NS::XmlOutputter *outputter ) =0; /*! Called when the XmlOutputter is destroyed. * @@ -90,7 +90,7 @@ struct CppUnitTestPlugIn * reference on test that are no longer available if they are not * unregistered. */ - virtual void uninitialize( CPPUNIT_NS(TestFactoryRegistry) *registry ) =0; + virtual void uninitialize( CPPUNIT_NS::TestFactoryRegistry *registry ) =0; }; @@ -186,7 +186,7 @@ typedef CppUnitTestPlugIn *(*TestPlugInSignature)(); * \see CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL(), CPPUNIT_PLUGIN_IMPLEMENT_MAIN(). */ #define CPPUNIT_PLUGIN_IMPLEMENT() \ - CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL( CPPUNIT_NS(TestPlugInDefaultImpl) ); \ + CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL( CPPUNIT_NS::TestPlugInDefaultImpl ); \ CPPUNIT_PLUGIN_IMPLEMENT_MAIN() diff --git a/include/cppunit/plugin/TestPlugInDefaultImpl.h b/include/cppunit/plugin/TestPlugInDefaultImpl.h index a6cc09e..f1efd81 100644 --- a/include/cppunit/plugin/TestPlugInDefaultImpl.h +++ b/include/cppunit/plugin/TestPlugInDefaultImpl.h @@ -13,7 +13,7 @@ CPPUNIT_NS_BEGIN class TestSuite; -/*! Default implementation of test plug-in interface. +/*! \brief Default implementation of test plug-in interface. * \ingroup WritingTestPlugIn * * Override getSuiteName() to specify the suite name. Default is "All Tests". diff --git a/include/cppunit/tools/StringTools.h b/include/cppunit/tools/StringTools.h index d08c6e0..7a6b6d7 100644 --- a/include/cppunit/tools/StringTools.h +++ b/include/cppunit/tools/StringTools.h @@ -3,7 +3,7 @@ #include <cppunit/Portability.h> #include <string> -#include <vector> +#include <cppunit/portability/CppUnitVector.h> CPPUNIT_NS_BEGIN @@ -14,7 +14,7 @@ CPPUNIT_NS_BEGIN struct StringTools { - typedef std::vector<std::string> Strings; + typedef CppUnitVector<std::string> Strings; static std::string CPPUNIT_API toString( int value ); diff --git a/include/cppunit/tools/XmlDocument.h b/include/cppunit/tools/XmlDocument.h index 005c736..8eba6d1 100644 --- a/include/cppunit/tools/XmlDocument.h +++ b/include/cppunit/tools/XmlDocument.h @@ -17,7 +17,7 @@ CPPUNIT_NS_BEGIN class XmlElement; -/*! A XML Document. +/*! \brief A XML Document. * * A XmlDocument represents a XML file. It holds a pointer on the root XmlElement * of the document. It also holds the encoding and style sheet used. diff --git a/include/cppunit/tools/XmlElement.h b/include/cppunit/tools/XmlElement.h index 8d4d504..62d9e73 100644 --- a/include/cppunit/tools/XmlElement.h +++ b/include/cppunit/tools/XmlElement.h @@ -8,7 +8,7 @@ #pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z #endif -#include <deque> +#include <cppunit/portability/CppUnitDeque.h> #include <string> @@ -131,10 +131,10 @@ private: std::string m_name; std::string m_content; - typedef std::deque<Attribute> Attributes; + typedef CppUnitDeque<Attribute> Attributes; Attributes m_attributes; - typedef std::deque<XmlElement *> Elements; + typedef CppUnitDeque<XmlElement *> Elements; Elements m_elements; }; diff --git a/include/cppunit/ui/mfc/Makefile.am b/include/cppunit/ui/mfc/Makefile.am index 5d84e7b..1ea8b5e 100644 --- a/include/cppunit/ui/mfc/Makefile.am +++ b/include/cppunit/ui/mfc/Makefile.am @@ -1,4 +1,5 @@ libcppunitincludedir = $(includedir)/cppunit/ui/mfc libcppunitinclude_HEADERS = \ - TestRunner.h + TestRunner.h \ + MfcTestRunner.h diff --git a/include/cppunit/ui/mfc/MfcTestRunner.h b/include/cppunit/ui/mfc/MfcTestRunner.h new file mode 100644 index 0000000..6a5f7b7 --- /dev/null +++ b/include/cppunit/ui/mfc/MfcTestRunner.h @@ -0,0 +1,76 @@ +#ifndef CPPUNITUI_MFC_MFCTESTRUNNER_H +#define CPPUNITUI_MFC_MFCTESTRUNNER_H + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#include <cppunit/Portability.h> +#include <cppunit/portability/CppUnitVector.h> + +/* Refer to MSDN documentation to know how to write and use MFC extension DLL: + mk:@MSITStore:h:\DevStudio\MSDN\98VSa\1036\vcmfc.chm::/html/_mfcnotes_tn033.htm#_mfcnotes_how_to_write_an_mfc_extension_dll + + This can be found in the index with "mfc extension" + The basic: + Using: + - your application must use MFC DLL + - memory allocation is done using the same heap + - you must define the symbol _AFX_DLL + + Building: + - you must define the symbol _AFX_DLL and _AFX_EXT + - export class using AFX_EXT_CLASS + */ + +CPPUNIT_NS_BEGIN + + class Test; + class TestSuite; + + +/*! \brief MFC test runner. + * \ingroup ExecutingTest + * + * Use this to launch the MFC TestRunner. Usually called from you CWinApp subclass: + * + * \code + * #include <cppunit/ui/mfc/MfcTestRunner.h> + * #include <cppunit/extensions/TestFactoryRegistry.h> + * + * void + * CHostAppApp::RunUnitTests() + * { + * CppUnit::MfcTestRunner runner; + * runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() ); + * + * runner.run(); + * } + * \endcode + * \see CppUnit::TextTestRunner, CppUnit::TestFactoryRegistry. + */ +class AFX_EXT_CLASS MfcTestRunner +{ +public: + MfcTestRunner(); + virtual ~MfcTestRunner(); + + void run(); + + void addTest( Test *test ); + + void addTests( const CppUnitVector<Test *> &tests ); + +protected: + Test *getRootTest(); + + TestSuite *m_suite; + + typedef CppUnitVector<Test *> Tests; + Tests m_tests; +}; + + +CPPUNIT_NS_END + +#endif // CPPUNITUI_MFC_MFCTESTRUNNER_H
\ No newline at end of file diff --git a/include/cppunit/ui/mfc/TestRunner.h b/include/cppunit/ui/mfc/TestRunner.h index 7186bf6..c4d6aff 100644 --- a/include/cppunit/ui/mfc/TestRunner.h +++ b/include/cppunit/ui/mfc/TestRunner.h @@ -1,82 +1,19 @@ #ifndef CPPUNITUI_MFC_TESTRUNNER_H #define CPPUNITUI_MFC_TESTRUNNER_H - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - -#include <cppunit/Portability.h> -#include <vector> - -/* Refer to MSDN documentation to know how to write and use MFC extension DLL: - mk:@MSITStore:h:\DevStudio\MSDN\98VSa\1036\vcmfc.chm::/html/_mfcnotes_tn033.htm#_mfcnotes_how_to_write_an_mfc_extension_dll - - This can be found in the index with "mfc extension" - The basic: - Using: - - your application must use MFC DLL - - memory allocation is done using the same heap - - you must define the symbol _AFX_DLL - - Building: - - you must define the symbol _AFX_DLL and _AFX_EXT - - export class using AFX_EXT_CLASS - */ +#include <cppunit/ui/mfc/MfcTestRunner.h> CPPUNIT_NS_BEGIN - class Test; - class TestSuite; - +#if defined(CPPUNIT_HAVE_NAMESPACES) namespace MfcUi { - - -/*! \brief MFC test runner. - * \ingroup ExecutingTest - * - * Use this to launch the MFC TestRunner. Usually called from you CWinApp subclass: - * - * \code - * #include <cppunit/ui/mfc/TestRunner.h> - * #include <cppunit/extensions/TestFactoryRegistry.h> - * - * void - * CHostAppApp::RunUnitTests() - * { - * CppUnit::MfcUi::TestRunner runner; - * runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() ); - * - * runner.run(); - * } - * \endcode - * \see CppUnit::TextUi::TestRunner, CppUnit::TestFactoryRegistry. - */ -class AFX_EXT_CLASS TestRunner -{ -public: - TestRunner(); - virtual ~TestRunner(); - - void run(); - - void addTest( Test *test ); - - void addTests( const std::vector<Test *> &tests ); - -protected: - Test *getRootTest(); - - TestSuite *m_suite; - - typedef std::vector<Test *> Tests; - Tests m_tests; -}; - - -} // namespace MfcUi - + /*! Mfc TestRunner (DEPRECATED). + * \deprecated Use CppUnit::MfcTestRunner instead. + */ + typedef CPPUNIT_NS::MfcTestRunner TestRunner; +} +#endif // defined(CPPUNIT_HAVE_NAMESPACES) CPPUNIT_NS_END diff --git a/include/cppunit/ui/qt/Makefile.am b/include/cppunit/ui/qt/Makefile.am index eb213f7..7d4fb46 100644 --- a/include/cppunit/ui/qt/Makefile.am +++ b/include/cppunit/ui/qt/Makefile.am @@ -2,4 +2,5 @@ libcppunitincludedir = $(includedir)/cppunit/ui/qt libcppunitinclude_HEADERS = \ TestRunner.h \ + QtTestRunner.h \ Config.h diff --git a/include/cppunit/ui/qt/QtTestRunner.h b/include/cppunit/ui/qt/QtTestRunner.h new file mode 100644 index 0000000..4b6ab4e --- /dev/null +++ b/include/cppunit/ui/qt/QtTestRunner.h @@ -0,0 +1,85 @@ +// ////////////////////////////////////////////////////////////////////////// +// Header file TestRunner.h for class TestRunner +// (c)Copyright 2000, Baptiste Lepilleur. +// Created: 2001/09/19 +// ////////////////////////////////////////////////////////////////////////// +#ifndef CPPUNIT_QTUI_QTTESTRUNNER_H +#define CPPUNIT_QTUI_QTTESTRUNNER_H + +#include <cppunit/portability/CppUnitVector.h> +#include "Config.h" + +CPPUNIT_NS_BEGIN + + + class Test; + class TestSuite; + + +/*! + * \brief QT test runner. + * \ingroup ExecutingTest + * + * Here is an example of usage: + * \code + * #include <cppunit/extensions/TestFactoryRegistry.h> + * #include <cppunit/ui/qt/TestRunner.h> + * + * [...] + * + * void + * QDepWindow::runTests() + * { + * CppUnit::QtUi::TestRunner runner; + * runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() ); + * runner.run( true ); + * } + * \endcode + * + */ +class QTTESTRUNNER_API QtTestRunner +{ +public: + /*! Constructs a TestRunner object. + */ + QtTestRunner(); + + /*! Destructor. + */ + virtual ~QtTestRunner(); + + void run( bool autoRun =false ); + + void addTest( Test *test ); + +private: + /// Prevents the use of the copy constructor. + QtTestRunner( const QtTestRunner © ); + + /// Prevents the use of the copy operator. + void operator =( const QtTestRunner © ); + + Test *getRootTest(); + +private: + typedef CppUnitVector<Test *> Tests; + Tests *_tests; + + TestSuite *_suite; +}; + + +#if CPPUNIT_HAVE_NAMESPACES + namespace QtUi + { + /*! Qt TestRunner (DEPRECATED). + * \deprecated Use CppUnit::QtTestRunner instead. + */ + typedef CPPUNIT_NS::QtTestRunner TestRunner; + } +#endif + + +CPPUNIT_NS_END + +#endif // CPPUNIT_QTUI_QTTESTRUNNER_H diff --git a/include/cppunit/ui/qt/TestRunner.h b/include/cppunit/ui/qt/TestRunner.h index d58772b..9c53e4b 100644 --- a/include/cppunit/ui/qt/TestRunner.h +++ b/include/cppunit/ui/qt/TestRunner.h @@ -6,71 +6,6 @@ #ifndef CPPUNIT_QTUI_TESTRUNNER_H #define CPPUNIT_QTUI_TESTRUNNER_H -#include <vector> -#include "Config.h" - -CPPUNIT_NS_BEGIN - - - class Test; - class TestSuite; - - namespace QtUi - { - -/*! - * \brief QT test runner. - * \ingroup ExecutingTest - * - * Here is an example of usage: - * \code - * #include <cppunit/extensions/TestFactoryRegistry.h> - * #include <cppunit/ui/qt/TestRunner.h> - * - * [...] - * - * void - * QDepWindow::runTests() - * { - * CppUnit::QtUi::TestRunner runner; - * runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() ); - * runner.run( true ); - * } - * \endcode - * - */ -class QTTESTRUNNER_API TestRunner -{ -public: - /*! Constructs a TestRunner object. - */ - TestRunner(); - - /*! Destructor. - */ - virtual ~TestRunner(); - - void run( bool autoRun =false ); - - void addTest( Test *test ); - -private: - /// Prevents the use of the copy constructor. - TestRunner( const TestRunner © ); - - /// Prevents the use of the copy operator. - void operator =( const TestRunner © ); - - Test *getRootTest(); - -private: - typedef std::vector<Test *> Tests; - Tests *_tests; - - TestSuite *_suite; -}; - - -CPPUNIT_NS_END +#include <cppunit/ui/qt/QtTestRunner.h> #endif // CPPUNIT_QTUI_TESTRUNNER_H diff --git a/include/cppunit/ui/text/Makefile.am b/include/cppunit/ui/text/Makefile.am index 59d5c3e..5f01d81 100644 --- a/include/cppunit/ui/text/Makefile.am +++ b/include/cppunit/ui/text/Makefile.am @@ -1,4 +1,5 @@ libcppunitincludedir = $(includedir)/cppunit/ui/text libcppunitinclude_HEADERS = \ - TestRunner.h + TestRunner.h \ + TextTestRunner.h diff --git a/include/cppunit/ui/text/TestRunner.h b/include/cppunit/ui/text/TestRunner.h index 13bb8b0..c931f66 100644 --- a/include/cppunit/ui/text/TestRunner.h +++ b/include/cppunit/ui/text/TestRunner.h @@ -1,100 +1,18 @@ #ifndef CPPUNIT_UI_TEXT_TESTRUNNER_H #define CPPUNIT_UI_TEXT_TESTRUNNER_H -// Notes: this class is implemented in TextTestRunner.cpp. - -#include <cppunit/Portability.h> -#include <string> -#include <vector> -#include <cppunit/TestRunner.h> +#include <cppunit/ui/text/TextTestRunner.h> CPPUNIT_NS_BEGIN -class Outputter; -class Test; -class TestSuite; -class TextOutputter; -class TestResult; -class TestResultCollector; - -namespace TextUi -{ - /*! * \brief A text mode test runner. - * \ingroup WritingTestResult * \ingroup ExecutingTest - * - * The test runner manage the life cycle of the added tests. - * - * The test runner can run only one of the added tests or all the tests. - * - * TestRunner prints out a trace as the tests are executed followed by a - * summary at the end. The trace and summary print are optional. - * - * Here is an example of use: - * - * \code - * CppUnit::TextUi::TestRunner runner; - * runner.addTest( ExampleTestCase::suite() ); - * runner.run( "", true ); // Run all tests and wait - * \endcode - * - * The trace is printed using a TextTestProgressListener. The summary is printed - * using a TextOutputter. - * - * You can specify an alternate Outputter at construction - * or later with setOutputter(). - * - * After construction, you can register additional TestListener to eventManager(), - * for a custom progress trace, for example. - * - * \code - * CppUnit::TextUi::TestRunner runner; - * runner.addTest( ExampleTestCase::suite() ); - * runner.setOutputter( CppUnit::CompilerOutputter::defaultOutputter( - * &runner.result(), - * std::cerr ) ); - * MyCustomProgressTestListener progress; - * runner.eventManager().addListener( &progress ); - * runner.run( "", true ); // Run all tests and wait - * \endcode - * - * \see CompilerOutputter, XmlOutputter, TextOutputter. + * \deprecated Use CppUnit::TextUi::TestRunner instead. */ -class CPPUNIT_API TestRunner : public CPPUNIT_NS(TestRunner) -{ -public: - // Work around VC++ bug (class has same name as parent) - typedef CPPUNIT_NS(TestRunner) SuperClass; - - TestRunner( Outputter *outputter =NULL ); - - virtual ~TestRunner(); - - bool run( std::string testPath ="", - bool doWait = false, - bool doPrintResult = true, - bool doPrintProgress = true ); - - void setOutputter( Outputter *outputter ); - - TestResultCollector &result() const; - - TestResult &eventManager() const; - -protected: - virtual void wait( bool doWait ); - virtual void printResult( bool doPrintResult ); - - TestResultCollector *m_result; - TestResult *m_eventManager; - Outputter *m_outputter; -}; - +typedef CPPUNIT_NS::TextUi::TestRunner TextTestRunner; -} // namespace TextUi CPPUNIT_NS_END diff --git a/include/cppunit/ui/text/TextTestRunner.h b/include/cppunit/ui/text/TextTestRunner.h new file mode 100644 index 0000000..dee37a7 --- /dev/null +++ b/include/cppunit/ui/text/TextTestRunner.h @@ -0,0 +1,94 @@ +#ifndef CPPUNIT_TEXTTESTRUNNER_H +#define CPPUNIT_TEXTTESTRUNNER_H + + +#include <cppunit/Portability.h> +#include <string> +#include <vector> +#include <cppunit/TestRunner.h> + +CPPUNIT_NS_BEGIN + + +class Outputter; +class Test; +class TestSuite; +class TextOutputter; +class TestResult; +class TestResultCollector; + + + +/*! + * \brief A text mode test runner. + * \ingroup WritingTestResult + * \ingroup ExecutingTest + * + * The test runner manage the life cycle of the added tests. + * + * The test runner can run only one of the added tests or all the tests. + * + * TestRunner prints out a trace as the tests are executed followed by a + * summary at the end. The trace and summary print are optional. + * + * Here is an example of use: + * + * \code + * CppUnit::TextTestRunner runner; + * runner.addTest( ExampleTestCase::suite() ); + * runner.run( "", true ); // Run all tests and wait + * \endcode + * + * The trace is printed using a TextTestProgressListener. The summary is printed + * using a TextOutputter. + * + * You can specify an alternate Outputter at construction + * or later with setOutputter(). + * + * After construction, you can register additional TestListener to eventManager(), + * for a custom progress trace, for example. + * + * \code + * CppUnit::TextTestRunner runner; + * runner.addTest( ExampleTestCase::suite() ); + * runner.setOutputter( CppUnit::CompilerOutputter::defaultOutputter( + * &runner.result(), + * std::cerr ) ); + * MyCustomProgressTestListener progress; + * runner.eventManager().addListener( &progress ); + * runner.run( "", true ); // Run all tests and wait + * \endcode + * + * \see CompilerOutputter, XmlOutputter, TextOutputter. + */ +class CPPUNIT_API TextTestRunner : public CPPUNIT_NS::TestRunner +{ +public: + TextTestRunner( Outputter *outputter =NULL ); + + virtual ~TextTestRunner(); + + bool run( std::string testPath ="", + bool doWait = false, + bool doPrintResult = true, + bool doPrintProgress = true ); + + void setOutputter( Outputter *outputter ); + + TestResultCollector &result() const; + + TestResult &eventManager() const; + +protected: + virtual void wait( bool doWait ); + virtual void printResult( bool doPrintResult ); + + TestResultCollector *m_result; + TestResult *m_eventManager; + Outputter *m_outputter; +}; + + +CPPUNIT_NS_END + +#endif // CPPUNIT_TEXTTESTRUNNER_H diff --git a/include/msvc6/testrunner/TestRunner.h b/include/msvc6/testrunner/TestRunner.h index a1deee4..0bee97a 100644 --- a/include/msvc6/testrunner/TestRunner.h +++ b/include/msvc6/testrunner/TestRunner.h @@ -6,12 +6,12 @@ #pragma once #endif // _MSC_VER >= 1000 -#include <cppunit/ui/mfc/TestRunner.h> +#include <cppunit/ui/mfc/MfcTestRunner.h> /*! \brief MFC test runner (DEPRECATED) * \ingroup ExecutingTest * \deprecated Use CppUnit::MfcUi::TestRunner instead. */ -typedef CppUnit::MfcUi::TestRunner TestRunner; +typedef CPPUNIT_NS::MfcTestRunner TestRunner; #endif // CPPUNIT_MSVC_TESTRUNNER_H diff --git a/src/cppunit/Asserter.cpp b/src/cppunit/Asserter.cpp index 1c72aff..a9cf95c 100644 --- a/src/cppunit/Asserter.cpp +++ b/src/cppunit/Asserter.cpp @@ -6,29 +6,26 @@ CPPUNIT_NS_BEGIN -namespace Asserter -{ - void -fail( std::string message, - const SourceLine &sourceLine ) +Asserter::fail( std::string message, + const SourceLine &sourceLine ) { fail( Message( "assertion failed", message ), sourceLine ); } void -fail( const Message &message, - const SourceLine &sourceLine ) +Asserter::fail( const Message &message, + const SourceLine &sourceLine ) { throw Exception( message, sourceLine ); } void -failIf( bool shouldFail, - const Message &message, - const SourceLine &sourceLine ) +Asserter::failIf( bool shouldFail, + const Message &message, + const SourceLine &sourceLine ) { if ( shouldFail ) fail( message, sourceLine ); @@ -36,33 +33,33 @@ failIf( bool shouldFail, void -failIf( bool shouldFail, - std::string message, - const SourceLine &sourceLine ) +Asserter::failIf( bool shouldFail, + std::string message, + const SourceLine &sourceLine ) { failIf( shouldFail, Message( "assertion failed", message ), sourceLine ); } std::string -makeExpected( const std::string &expectedValue ) +Asserter::makeExpected( const std::string &expectedValue ) { return "Expected: " + expectedValue; } std::string -makeActual( const std::string &actualValue ) +Asserter::makeActual( const std::string &actualValue ) { return "Actual : " + actualValue; } Message -makeNotEqualMessage( const std::string &expectedValue, - const std::string &actualValue, - const AdditionalMessage &additionalMessage, - const std::string &shortDescription ) +Asserter::makeNotEqualMessage( const std::string &expectedValue, + const std::string &actualValue, + const AdditionalMessage &additionalMessage, + const std::string &shortDescription ) { Message message( shortDescription, makeExpected( expectedValue ), @@ -74,11 +71,11 @@ makeNotEqualMessage( const std::string &expectedValue, void -failNotEqual( std::string expected, - std::string actual, - const SourceLine &sourceLine, - const AdditionalMessage &additionalMessage, - std::string shortDescription ) +Asserter::failNotEqual( std::string expected, + std::string actual, + const SourceLine &sourceLine, + const AdditionalMessage &additionalMessage, + std::string shortDescription ) { fail( makeNotEqualMessage( expected, actual, @@ -89,17 +86,16 @@ failNotEqual( std::string expected, void -failNotEqualIf( bool shouldFail, - std::string expected, - std::string actual, - const SourceLine &sourceLine, - const AdditionalMessage &additionalMessage, - std::string shortDescription ) +Asserter::failNotEqualIf( bool shouldFail, + std::string expected, + std::string actual, + const SourceLine &sourceLine, + const AdditionalMessage &additionalMessage, + std::string shortDescription ) { if ( shouldFail ) failNotEqual( expected, actual, sourceLine, additionalMessage, shortDescription ); } -} // namespace Asserter CPPUNIT_NS_END diff --git a/src/cppunit/TestFactoryRegistry.cpp b/src/cppunit/TestFactoryRegistry.cpp index b4c8e4f..095caa6 100644 --- a/src/cppunit/TestFactoryRegistry.cpp +++ b/src/cppunit/TestFactoryRegistry.cpp @@ -6,7 +6,8 @@ CPPUNIT_NS_BEGIN - +/*! \brief (INTERNAL) List of all TestFactoryRegistry. + */ class TestFactoryRegistryList { private: diff --git a/src/cppunit/TestSuite.cpp b/src/cppunit/TestSuite.cpp index e2db8ae..4a27788 100644 --- a/src/cppunit/TestSuite.cpp +++ b/src/cppunit/TestSuite.cpp @@ -38,7 +38,7 @@ TestSuite::addTest( Test *test ) } -const std::vector<Test *> & +const CppUnitVector<Test *> & TestSuite::getTests() const { return m_tests; diff --git a/src/cppunit/TextTestRunner.cpp b/src/cppunit/TextTestRunner.cpp index 47a9cda..2be2d06 100644 --- a/src/cppunit/TextTestRunner.cpp +++ b/src/cppunit/TextTestRunner.cpp @@ -5,19 +5,18 @@ #include <cppunit/TextOutputter.h> #include <cppunit/TextTestProgressListener.h> #include <cppunit/TestResult.h> -#include <cppunit/ui/text/TestRunner.h> +#include <cppunit/ui/text/TextTestRunner.h> #include <iostream> #include <stdexcept> CPPUNIT_NS_BEGIN -namespace TextUi { /*! Constructs a new text runner. * \param outputter used to print text result. Owned by the runner. */ -TestRunner::TestRunner( Outputter *outputter ) +TextTestRunner::TextTestRunner( Outputter *outputter ) : m_outputter( outputter ) , m_result( new TestResultCollector() ) , m_eventManager( new TestResult() ) @@ -28,7 +27,7 @@ TestRunner::TestRunner( Outputter *outputter ) } -TestRunner::~TestRunner() +TextTestRunner::~TextTestRunner() { delete m_eventManager; delete m_outputter; @@ -51,16 +50,16 @@ TestRunner::~TestRunner() * failed or was not found. */ bool -TestRunner::run( std::string testName, - bool doWait, - bool doPrintResult, - bool doPrintProgress ) +TextTestRunner::run( std::string testName, + bool doWait, + bool doPrintResult, + bool doPrintProgress ) { TextTestProgressListener progress; if ( doPrintProgress ) m_eventManager->addListener( &progress ); - SuperClass *pThis = this; + TestRunner *pThis = this; pThis->run( *m_eventManager, testName ); if ( doPrintProgress ) @@ -74,7 +73,7 @@ TestRunner::run( std::string testName, void -TestRunner::wait( bool doWait ) +TextTestRunner::wait( bool doWait ) { if ( doWait ) { @@ -85,7 +84,7 @@ TestRunner::wait( bool doWait ) void -TestRunner::printResult( bool doPrintResult ) +TextTestRunner::printResult( bool doPrintResult ) { std::cout << std::endl; if ( doPrintResult ) @@ -97,7 +96,7 @@ TestRunner::printResult( bool doPrintResult ) * Use this after calling run() to access the result of the test run. */ TestResultCollector & -TestRunner::result() const +TextTestRunner::result() const { return *m_result; } @@ -108,7 +107,7 @@ TestRunner::result() const * test. Use this to register additional TestListener before running the tests. */ TestResult & -TestRunner::eventManager() const +TextTestRunner::eventManager() const { return *m_eventManager; } @@ -121,12 +120,11 @@ TestRunner::eventManager() const * \see CompilerOutputter, XmlOutputter, TextOutputter. */ void -TestRunner::setOutputter( Outputter *outputter ) +TextTestRunner::setOutputter( Outputter *outputter ) { delete m_outputter; m_outputter = outputter; } -} // namespace TextUi CPPUNIT_NS_END diff --git a/src/cppunit/cppunit.dsp b/src/cppunit/cppunit.dsp index d618538..76564e1 100644 --- a/src/cppunit/cppunit.dsp +++ b/src/cppunit/cppunit.dsp @@ -189,6 +189,10 @@ SOURCE=.\TextTestRunner.cpp 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 "portability" @@ -211,11 +215,19 @@ SOURCE=..\..\include\cppunit\config\CppUnitApi.h # End Source File # Begin Source File -SOURCE=..\..\include\cppunit\Portability.h +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\config\PortabilityEpilog.h +SOURCE=..\..\include\cppunit\portability\CppUnitVector.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\cppunit\Portability.h # End Source File # Begin Source File @@ -248,6 +260,15 @@ SOURCE=..\..\include\cppunit\TextOutputter.h # Begin Source File SOURCE=.\XmlOutputter.cpp + +!IF "$(CFG)" == "cppunit - Win32 Release" + +!ELSEIF "$(CFG)" == "cppunit - Win32 Debug" + +# ADD CPP /W3 + +!ENDIF + # End Source File # Begin Source File diff --git a/src/msvc6/testpluginrunner/TestPlugIn.cpp b/src/msvc6/testpluginrunner/TestPlugIn.cpp index 7c46fb1..7fd0574 100644 --- a/src/msvc6/testpluginrunner/TestPlugIn.cpp +++ b/src/msvc6/testpluginrunner/TestPlugIn.cpp @@ -32,7 +32,7 @@ TestPlugIn::deleteDllCopy() } -class NullTest : public CppUnit::TestCase +class NullTest : public CPPUNIT_NS::TestCase { public: NullTest( std::string name ) : TestCase( name ) @@ -50,11 +50,11 @@ public: }; -CppUnit::Test * +CPPUNIT_NS::Test * TestPlugIn::makeTest() { reloadDll(); - return CppUnit::TestFactoryRegistry::getRegistry().makeTest(); + return CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest(); } @@ -85,7 +85,7 @@ TestPlugIn::loadDll() { m_manager.load( m_copyFileName ); } - catch ( CppUnit::DynamicLibraryManagerException &e ) + catch ( CPPUNIT_NS::DynamicLibraryManagerException &e ) { throw TestPlugInException( e.what(), TestPlugInException::failedToLoadDll ); diff --git a/src/msvc6/testpluginrunner/TestPlugIn.h b/src/msvc6/testpluginrunner/TestPlugIn.h index d2b9329..73b0d14 100644 --- a/src/msvc6/testpluginrunner/TestPlugIn.h +++ b/src/msvc6/testpluginrunner/TestPlugIn.h @@ -28,7 +28,7 @@ public: /*! Obtains a new test from a new copy of the dll. * \exception TestPlugInException if a error occurs. */ - CppUnit::Test *makeTest(); + CPPUNIT_NS::Test *makeTest(); private: /// Prevents the use of the copy constructor. @@ -55,7 +55,7 @@ private: private: std::string m_fileName; std::string m_copyFileName; - CppUnit::PlugInManager m_manager; + CPPUNIT_NS::PlugInManager m_manager; }; diff --git a/src/msvc6/testpluginrunner/TestPlugInRunnerModel.cpp b/src/msvc6/testpluginrunner/TestPlugInRunnerModel.cpp index ae0effe..71ae0cf 100644 --- a/src/msvc6/testpluginrunner/TestPlugInRunnerModel.cpp +++ b/src/msvc6/testpluginrunner/TestPlugInRunnerModel.cpp @@ -11,7 +11,7 @@ TestPlugInRunnerModel::TestPlugInRunnerModel() : - TestRunnerModel( new CppUnit::TestSuite( "Default" ) ), + TestRunnerModel( new CPPUNIT_NS::TestSuite( "Default" ) ), m_plugIn( new TestPlugIn( "default plug-in" ) ) { } @@ -45,7 +45,7 @@ TestPlugInRunnerModel::reloadPlugIn() } catch (...) { - setRootTest( new CppUnit::TestSuite( "Default" ) ); + setRootTest( new CPPUNIT_NS::TestSuite( "Default" ) ); loadHistory(); throw; } diff --git a/src/msvc6/testrunner/ActiveTest.cpp b/src/msvc6/testrunner/ActiveTest.cpp index c919b8c..ec68a8d 100644 --- a/src/msvc6/testrunner/ActiveTest.cpp +++ b/src/msvc6/testrunner/ActiveTest.cpp @@ -4,7 +4,7 @@ // Spawn a thread to a test void -ActiveTest::run( CppUnit::TestResult *result ) +ActiveTest::run( CPPUNIT_NS::TestResult *result ) { CWinThread *thread; diff --git a/src/msvc6/testrunner/ActiveTest.h b/src/msvc6/testrunner/ActiveTest.h index 926be1f..91ed24c 100644 --- a/src/msvc6/testrunner/ActiveTest.h +++ b/src/msvc6/testrunner/ActiveTest.h @@ -24,28 +24,28 @@ * */ -class ActiveTest : public CppUnit::TestDecorator +class ActiveTest : public CPPUNIT_NS::TestDecorator { public: - ActiveTest( CppUnit::Test *test ); + ActiveTest( CPPUNIT_NS::Test *test ); ~ActiveTest(); - void run( CppUnit::TestResult *result ); + void run( CPPUNIT_NS::TestResult *result ); protected: HANDLE m_threadHandle; CEvent m_runCompleted; - CppUnit::TestResult *m_currentTestResult; + CPPUNIT_NS::TestResult *m_currentTestResult; void run(); - void setTestResult( CppUnit::TestResult *result ); + void setTestResult( CPPUNIT_NS::TestResult *result ); static UINT threadFunction( LPVOID thisInstance ); }; // Construct the active test inline -ActiveTest::ActiveTest( CppUnit::Test *test ) +ActiveTest::ActiveTest( CPPUNIT_NS::Test *test ) : TestDecorator( test ) , m_runCompleted() { @@ -64,7 +64,7 @@ ActiveTest::~ActiveTest() // Set the test result that we are to run inline void -ActiveTest::setTestResult( CppUnit::TestResult *result ) +ActiveTest::setTestResult( CPPUNIT_NS::TestResult *result ) { m_currentTestResult = result; } diff --git a/src/msvc6/testrunner/Change-Diary-ResourceBugFix.txt b/src/msvc6/testrunner/Change-Diary-ResourceBugFix.txt new file mode 100644 index 0000000..7fcdd3d --- /dev/null +++ b/src/msvc6/testrunner/Change-Diary-ResourceBugFix.txt @@ -0,0 +1,111 @@ +Diary of making test runner DLL resource safe. + +Repeat everything, that was done for version 1.8.0. This is point 1) to 9). + +0) With the unit-tests for the test runner DLL all four tests fail with the original + version 1.9.8 of CPP-Unit. + +1) Replace the original integer dialog ids with new string ids + CPP_UNIT_TEST_RUNNER_IDD_DIALOG_TEST_HIERARCHY + CPP_UNIT_TEST_RUNNER_IDD_DIALOG_TESTRUNNER + Because these are not in resource.h VC++ interpretes these values + as string ids. + +2) TestRunnerDlg.cpp: + - Make a copy of the constructor and replace the integer id with a string id. + - Move the initialization code in the two constructors to the new private member + function init(). + - Put an ASSERT in the old constructor. + - Remove the enum IDD=IDD_DIALOG_TESTRUNNER from the resource.h and TestRunnerDlg.h + header files. Accordingly remove the default value nDialogResourceId in the + constructor, that uses the integer id. + +3) TreeHierarchyDlg.cpp: + - Replace the integer id in the call to the base class constructor with + the new string id. + - Remove the enum IDD=IDD_DIALOG_TEST_HIERARCHY from the resource.h and + TreeHierarchyDlg.h header file. + +4) Test. Two of the four tests still fail. The remaining errors result from + the conflicts in the string table. + +5) Since strings ids don't work for the string table I created the new function + loadCString to load the strings from the correct resource module which is of + course the test runner module. The new function is in the files + ResourceLoaders.[cpp|h] since I didn't find a good existing place. Baptiste, + if you know of a good existing place simply move the function and remove the + two new files. + +6) Check all occurences of the strings and replace the original string refernces + with the new function loadCString. + IDS_ERROR_SELECT_TEST + IDS_ERRORLIST_TYPE + IDS_ERRORLIST_NAME + IDS_ERRORLIST_FAILED_CONDITION + IDS_ERRORLIST_LINE_NUMBER + IDS_ERRORLIST_FILE_NAME + +7) Test. No more errors are found. + +8) Change the two bitmaps that are used in the list and the tree to use + string ids instead of integer ids. + - First changed the unit test so that the originally incorrect behaviour + is shown. Inserted red circles in the bitmaps in the unit test. + Then added the new test checkListBitmaps() and changed checkBrowseDlg() + to let the user visually check, if the correct bitmaps are used. + This has to be done by the user visually, because I couldn't think of + an automatic test, that could be implemented easily. + The last test for the correct bitmaps will ALWAYS fail, so that the + bitmaps can be checked visually. + - Changed the RC-file of the test runner DLL: + CPP_UNIT_TEST_RUNNER_IDB_TEST_TYPE + CPP_UNIT_TEST_RUNNER_IDB_ERROR_TYPE + Removed the original string ids from resource.h and changed TreeHierarchyDlg.cpp + and TestRunnerDlg.cpp so that the new string ids are used. + + +9) Changed the TestPlugInRunner. I don't know, how I can test this and would + ask you Baptiste to check it or let me know, how I can check it. + I did the following: + - Change the dialog id to the string id + CPP_UNIT_TEST_RUNNER_PLUG_IN_IDD_TEST_PLUG_IN_RUNNER + ^^^^^^^ => This is different from the string id used + in the test runner DLL! + - Removed the original integer id from resource.h and TestPlugInRunnerDlg.h. + - Changed the constructor in TestPlugInRunnerDlg.cpp to use the new string id. + - Replaced the integer id IDR_TEST_PLUGIN_RUNNER for the icon with the string + id CPP_UNIT_TEST_RUNNER_PLUG_IN_IDR_TEST_PLUGIN_RUNNER in the RC-file and in + the constructor TestPlugInRunnerDlg and removed the original id from resource.h. + + +Here start the changes, that were only needed for version 1.9.8. + +10) TestRunner is OK now. But I saw, that TestPlugInRunner has now more + resources than in version 1.8.0. After looking at it more carefully + it turned out that the sources of the test runner DLL have been + included in the test plug-in runner. In version 1.8.0 the test runner + was used through the testrunner.dll. This means that some additional + changes have to be made to the test plug-in runner. + - Additionally changed IDD_DIALOG_TEST_HIERARCHY to + CPP_UNIT_TEST_RUNNER_IDD_DIALOG_TEST_HIERARCHY. This is the same + name as in the original test runner because the dialog is created + with the original code. I don't know how to check this, thus I'm + not sure wether this is OK. + - Replaced the ids for the bitmaps. Here the same applies as in the + previous point, I'm not sure, if it works. + - Include ResourceLoaders.cpp in the subproject + TestPlugInRunner/TestRunner-Was-In-Dll/UserInterface + - Removed the original #include "TestRunnerApp.h" in ResourceLoaders.cpp + and replaced it with + extern HINSTANCE g_testRunnerResource; + - Included + HINSTANCE g_testRunnerResource; + in TestPlugInRunnerApp.cpp and set the variable in InitInstance() with + g_testRunnerResource = AfxGetResourceHandle(); + - Replaced the integer id for the icon with a string id + m_hIcon = AfxGetApp()->LoadIcon("CPP_UNIT_TEST_RUNNER_PLUG_IN_IDR_TEST_PLUGIN_RUNNER"); + in the constructor in TestPlugInRunnerDlg.cpp and in the RC-file. + +11) FINISHED. + +-- Steven Mitter
\ No newline at end of file diff --git a/src/msvc6/testrunner/MfcSynchronizationObject.h b/src/msvc6/testrunner/MfcSynchronizationObject.h index 2b68712..34a6aa4 100644 --- a/src/msvc6/testrunner/MfcSynchronizationObject.h +++ b/src/msvc6/testrunner/MfcSynchronizationObject.h @@ -13,7 +13,7 @@ * \brief This class represents a lock object for synchronized object. */ class MfcSynchronizationObject - : public CppUnit::SynchronizedObject::SynchronizationObject + : public CPPUNIT_NS::SynchronizedObject::SynchronizationObject { CCriticalSection m_syncObject; diff --git a/src/msvc6/testrunner/TestRunner.cpp b/src/msvc6/testrunner/MfcTestRunner.cpp index 859a31a..0d383a1 100644 --- a/src/msvc6/testrunner/TestRunner.cpp +++ b/src/msvc6/testrunner/MfcTestRunner.cpp @@ -1,31 +1,27 @@ // ////////////////////////////////////////////////////////////////////////// -// Implementation file TestRunner.cpp for class TestRunner +// Implementation file MfcTestRunner.cpp for class MfcTestRunner // (c)Copyright 2000, Baptiste Lepilleur. // Created: 2001/04/26 // ////////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include <cppunit/ui/mfc/TestRunner.h> +#include <cppunit/ui/mfc/MfcTestRunner.h> #include <cppunit/TestSuite.h> #include "TestRunnerModel.h" #include "TestRunnerDlg.h" -namespace CppUnit -{ - -namespace MfcUi -{ +CPPUNIT_NS_BEGIN -TestRunner::TestRunner() : - m_suite( new CppUnit::TestSuite() ) +MfcTestRunner::MfcTestRunner() + : m_suite( new CPPUNIT_NS::TestSuite() ) { } -TestRunner::~TestRunner() +MfcTestRunner::~MfcTestRunner() { delete m_suite; @@ -35,7 +31,7 @@ TestRunner::~TestRunner() void -TestRunner::run() +MfcTestRunner::run() { bool comInit = SUCCEEDED( CoInitialize( NULL) ); @@ -49,16 +45,16 @@ TestRunner::run() void -TestRunner::addTest(CppUnit::Test *test) +MfcTestRunner::addTest( CPPUNIT_NS::Test *test ) { m_tests.push_back( test ); } void -TestRunner::addTests ( const std::vector<CppUnit::Test *> &tests ) +MfcTestRunner::addTests( const CppUnitVector<CPPUNIT_NS::Test *> &tests ) { - for ( std::vector<CppUnit::Test *>::const_iterator it=tests.begin(); + for ( Tests::const_iterator it=tests.begin(); it != tests.end(); ++it ) { @@ -67,8 +63,8 @@ TestRunner::addTests ( const std::vector<CppUnit::Test *> &tests ) } -CppUnit::Test * -TestRunner::getRootTest() +CPPUNIT_NS::Test * +MfcTestRunner::getRootTest() { if ( m_tests.size() != 1 ) { @@ -80,6 +76,4 @@ TestRunner::getRootTest() return m_tests[0]; } -} // namespace MfcUi - -} // namespace CppUnit +CPPUNIT_NS_END diff --git a/src/msvc6/testrunner/MostRecentTests.cpp b/src/msvc6/testrunner/MostRecentTests.cpp index 2f85f8a..9d437a7 100644 --- a/src/msvc6/testrunner/MostRecentTests.cpp +++ b/src/msvc6/testrunner/MostRecentTests.cpp @@ -20,7 +20,7 @@ MostRecentTests::~MostRecentTests() void -MostRecentTests::setLastTestRun( CppUnit::Test *test ) +MostRecentTests::setLastTestRun( CPPUNIT_NS::Test *test ) { for ( TestRuns::iterator it = m_runs.begin(); it != m_runs.end(); ++it ) { @@ -36,7 +36,7 @@ MostRecentTests::setLastTestRun( CppUnit::Test *test ) } -CppUnit::Test * +CPPUNIT_NS::Test * MostRecentTests::lastTestRun() const { return m_runs.front().second; @@ -50,7 +50,7 @@ MostRecentTests::getRunCount() const } -CppUnit::Test * +CPPUNIT_NS::Test * MostRecentTests::getTestAt( int indexTest ) const { return m_runs.at( indexTest ).second; diff --git a/src/msvc6/testrunner/MostRecentTests.h b/src/msvc6/testrunner/MostRecentTests.h index 285bb2d..339c3b7 100644 --- a/src/msvc6/testrunner/MostRecentTests.h +++ b/src/msvc6/testrunner/MostRecentTests.h @@ -25,11 +25,11 @@ public: */ virtual ~MostRecentTests(); - void setLastTestRun( CppUnit::Test *test ); - CppUnit::Test *lastTestRun() const; + void setLastTestRun( CPPUNIT_NS::Test *test ); + CPPUNIT_NS::Test *lastTestRun() const; int getRunCount() const; - CppUnit::Test *getTestAt( int indexTest ) const; + CPPUNIT_NS::Test *getTestAt( int indexTest ) const; std::string getTestNameAt( int indexTest ) const; @@ -41,16 +41,10 @@ private: void operator =( const MostRecentTests © ); private: - typedef std::pair<std::string, CppUnit::Test *> TestRun; + typedef std::pair<std::string, CPPUNIT_NS::Test *> TestRun; typedef std::deque<TestRun> TestRuns; TestRuns m_runs; }; - -// Inlines methods for MostRecentTests: -// ------------------------------------ - - - #endif // MOSTRECENTTESTS_H diff --git a/src/msvc6/testrunner/TestRunner.dsp b/src/msvc6/testrunner/TestRunner.dsp index 6992e1a..2eb01eb 100644 --- a/src/msvc6/testrunner/TestRunner.dsp +++ b/src/msvc6/testrunner/TestRunner.dsp @@ -410,7 +410,15 @@ SOURCE=.\MfcSynchronizationObject.h # End Source File # Begin Source File -SOURCE=.\TestRunner.cpp +SOURCE=.\MfcTestRunner.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\include\cppunit\ui\mfc\MfcTestRunner.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\include\cppunit\ui\mfc\TestRunner.h # End Source File # Begin Source File diff --git a/src/msvc6/testrunner/TestRunnerDlg.cpp b/src/msvc6/testrunner/TestRunnerDlg.cpp index 4ff598c..4aa95b3 100644 --- a/src/msvc6/testrunner/TestRunnerDlg.cpp +++ b/src/msvc6/testrunner/TestRunnerDlg.cpp @@ -198,8 +198,8 @@ TestRunnerDlg::OnRun() m_testsProgress->start( numberOfTests ); - m_result = new CppUnit::TestResultCollector( new MfcSynchronizationObject() ); - m_testObserver = new CppUnit::TestResult( new MfcSynchronizationObject() ); + m_result = new CPPUNIT_NS::TestResultCollector( new MfcSynchronizationObject() ); + m_testObserver = new CPPUNIT_NS::TestResult( new MfcSynchronizationObject() ); m_testObserver->addListener( m_result ); m_testObserver->addListener( this ); m_activeTest = new ActiveTest( m_selectedTest ); @@ -213,7 +213,7 @@ TestRunnerDlg::OnRun() void -TestRunnerDlg::addListEntry( const CppUnit::TestFailure &failure ) +TestRunnerDlg::addListEntry( const CPPUNIT_NS::TestFailure &failure ) { CListCtrl *listCtrl = (CListCtrl *)GetDlgItem (IDC_LIST); int currentEntry = m_result->testErrors() + @@ -263,7 +263,7 @@ TestRunnerDlg::addListEntry( const CppUnit::TestFailure &failure ) void -TestRunnerDlg::startTest( CppUnit::Test *test ) +TestRunnerDlg::startTest( CPPUNIT_NS::Test *test ) { CWnd *runningTestCaseLabel = GetDlgItem(IDC_RUNNING_TEST_CASE_LABEL); if ( runningTestCaseLabel ) @@ -272,7 +272,7 @@ TestRunnerDlg::startTest( CppUnit::Test *test ) void -TestRunnerDlg::addFailure( const CppUnit::TestFailure &failure ) +TestRunnerDlg::addFailure( const CPPUNIT_NS::TestFailure &failure ) { addListEntry( failure ); if ( failure.isError() ) @@ -285,7 +285,7 @@ TestRunnerDlg::addFailure( const CppUnit::TestFailure &failure ) void -TestRunnerDlg::endTest( CppUnit::Test *test ) +TestRunnerDlg::endTest( CPPUNIT_NS::Test *test ) { if ( m_selectedTest == 0 ) return; @@ -427,7 +427,7 @@ TestRunnerDlg::OnSelectTestInHistoryCombo() if ( currentSelection >= 0 && currentSelection < m_model->history().size() ) { - CppUnit::Test *selectedTest = m_model->history()[currentSelection]; + CPPUNIT_NS::Test *selectedTest = m_model->history()[currentSelection]; m_model->selectHistoryTest( selectedTest ); updateHistoryCombo(); beIdle(); @@ -449,7 +449,7 @@ TestRunnerDlg::updateHistoryCombo() it != history.end(); ++it ) { - CppUnit::Test *test = *it; + CPPUNIT_NS::Test *test = *it; getHistoryCombo()->AddString( CString(test->getName().c_str()) ); } diff --git a/src/msvc6/testrunner/TestRunnerDlg.h b/src/msvc6/testrunner/TestRunnerDlg.h index 7d8c07f..88192a0 100644 --- a/src/msvc6/testrunner/TestRunnerDlg.h +++ b/src/msvc6/testrunner/TestRunnerDlg.h @@ -47,7 +47,7 @@ class TestRunnerModel; // TestRunnerDlg dialog class TestRunnerDlg : public cdxCDynamicDialog, - public CppUnit::TestListener + public CPPUNIT_NS::TestListener { public: TestRunnerDlg( TestRunnerModel *model, @@ -59,9 +59,9 @@ public: ~TestRunnerDlg(); // overrided from TestListener; - void startTest( CppUnit::Test *test ); - void addFailure( const CppUnit::TestFailure &failure ); - void endTest( CppUnit::Test *test ); + void startTest( CPPUNIT_NS::Test *test ); + void addFailure( const CPPUNIT_NS::TestFailure &failure ); + void endTest( CPPUNIT_NS::Test *test ); // IDD is not use, it is just there for the wizard. //{{AFX_DATA(TestRunnerDlg) @@ -96,12 +96,12 @@ protected: //}}AFX_MSG DECLARE_MESSAGE_MAP() - typedef std::vector<CppUnit::Test *> Tests; + typedef std::vector<CPPUNIT_NS::Test *> Tests; ProgressBar *m_testsProgress; - CppUnit::Test *m_selectedTest; + CPPUNIT_NS::Test *m_selectedTest; ActiveTest *m_activeTest; - CppUnit::TestResult *m_testObserver; - CppUnit::TestResultCollector *m_result; + CPPUNIT_NS::TestResult *m_testObserver; + CPPUNIT_NS::TestResultCollector *m_result; int m_testsRun; int m_errors; int m_failures; @@ -120,7 +120,7 @@ protected: errorTypeError }; - void addListEntry( const CppUnit::TestFailure &failure ); + void addListEntry( const CPPUNIT_NS::TestFailure &failure ); void beIdle(); void beRunning(); void beRunDisabled(); @@ -128,13 +128,13 @@ protected: void freeState(); void updateCountsDisplay(); void setupHistoryCombo(); - CppUnit::Test *findTestByName( std::string name ) const; - CppUnit::Test *findTestByNameFor( const std::string &name, - CppUnit::Test *test ) const; - void addNewTestToHistory( CppUnit::Test *test ); - void addTestToHistoryCombo( CppUnit::Test *test, + CPPUNIT_NS::Test *findTestByName( std::string name ) const; + CPPUNIT_NS::Test *findTestByNameFor( const std::string &name, + CPPUNIT_NS::Test *test ) const; + void addNewTestToHistory( CPPUNIT_NS::Test *test ); + void addTestToHistoryCombo( CPPUNIT_NS::Test *test, int idx =-1 ); - void removeTestFromHistory( CppUnit::Test *test ); + void removeTestFromHistory( CPPUNIT_NS::Test *test ); CComboBox *getHistoryCombo(); void updateSelectedItem(); void saveHistory(); diff --git a/src/msvc6/testrunner/TestRunnerModel.cpp b/src/msvc6/testrunner/TestRunnerModel.cpp index bf0e0b6..a3ea830 100644 --- a/src/msvc6/testrunner/TestRunnerModel.cpp +++ b/src/msvc6/testrunner/TestRunnerModel.cpp @@ -16,7 +16,7 @@ const CString TestRunnerModel::settingMainDialogKey( _T( "MainDialog" ) ); const CString TestRunnerModel::settingBrowseDialogKey( _T( "BrowseDialog" ) ); -TestRunnerModel::TestRunnerModel( CppUnit::Test *rootTest ) : +TestRunnerModel::TestRunnerModel( CPPUNIT_NS::Test *rootTest ) : m_rootTest( rootTest ) { } @@ -34,7 +34,7 @@ TestRunnerModel::history() const void -TestRunnerModel::selectHistoryTest( CppUnit::Test *test ) +TestRunnerModel::selectHistoryTest( CPPUNIT_NS::Test *test ) { History::iterator end = std::remove( m_history.begin(), m_history.end(), test ); @@ -45,7 +45,7 @@ TestRunnerModel::selectHistoryTest( CppUnit::Test *test ) } -CppUnit::Test * +CPPUNIT_NS::Test * TestRunnerModel::selectedTest() const { if ( m_history.size() > 0 ) @@ -126,7 +126,7 @@ TestRunnerModel::saveSettings( const Settings & s ) it != m_history.end(); ++it , ++idx ) { - CppUnit::Test *test = *it; + CPPUNIT_NS::Test *test = *it; saveHistoryEntry( idx, test->getName().c_str() ); } } @@ -154,7 +154,7 @@ TestRunnerModel::getHistoryEntryName( int idx ) const } -CppUnit::Test * +CPPUNIT_NS::Test * TestRunnerModel::rootTest() { return m_rootTest; @@ -162,36 +162,36 @@ TestRunnerModel::rootTest() void -TestRunnerModel::setRootTest( CppUnit::Test *test ) +TestRunnerModel::setRootTest( CPPUNIT_NS::Test *test ) { m_rootTest = test; } -CppUnit::Test * +CPPUNIT_NS::Test * TestRunnerModel::findTestByName( CString name ) const { return findTestByNameFor( name, m_rootTest ); } -CppUnit::Test * +CPPUNIT_NS::Test * TestRunnerModel::findTestByNameFor( const CString &name, - CppUnit::Test *test ) const + CPPUNIT_NS::Test *test ) const { if ( name == test->getName().c_str() ) return test; - CppUnit::TestSuite *suite = dynamic_cast<CppUnit::TestSuite *>(test); + CPPUNIT_NS::TestSuite *suite = dynamic_cast<CPPUNIT_NS::TestSuite *>(test); if ( suite == NULL ) return NULL; - const std::vector<CppUnit::Test *> &tests = suite->getTests(); - for ( std::vector<CppUnit::Test *>::const_iterator it = tests.begin(); + const std::vector<CPPUNIT_NS::Test *> &tests = suite->getTests(); + for ( std::vector<CPPUNIT_NS::Test *>::const_iterator it = tests.begin(); it != tests.end(); ++it ) { - CppUnit::Test *testFound = findTestByNameFor( name, *it ); + CPPUNIT_NS::Test *testFound = findTestByNameFor( name, *it ); if ( testFound != NULL ) return testFound; } diff --git a/src/msvc6/testrunner/TestRunnerModel.h b/src/msvc6/testrunner/TestRunnerModel.h index 68445d9..ed12380 100644 --- a/src/msvc6/testrunner/TestRunnerModel.h +++ b/src/msvc6/testrunner/TestRunnerModel.h @@ -29,33 +29,33 @@ public: int col_4; // 4th column width in list view }; - typedef std::deque<CppUnit::Test *> History; + typedef std::deque<CPPUNIT_NS::Test *> History; /*! Constructs a TestRunnerModel object. */ - TestRunnerModel( CppUnit::Test *rootTest ); + TestRunnerModel( CPPUNIT_NS::Test *rootTest ); /*! Destructor. */ virtual ~TestRunnerModel(); - virtual void setRootTest( CppUnit::Test *rootTest ); + virtual void setRootTest( CPPUNIT_NS::Test *rootTest ); void loadSettings(Settings & s); void saveSettings(const Settings & s); const History &history() const; - void selectHistoryTest( CppUnit::Test *test ); - CppUnit::Test *selectedTest() const; + void selectHistoryTest( CPPUNIT_NS::Test *test ); + CPPUNIT_NS::Test *selectedTest() const; - CppUnit::Test *rootTest(); + CPPUNIT_NS::Test *rootTest(); protected: void loadHistory(); CString loadHistoryEntry( int idx ); - CppUnit::Test *findTestByName( CString name ) const; - CppUnit::Test *findTestByNameFor( const CString &name, - CppUnit::Test *test ) const; + CPPUNIT_NS::Test *findTestByName( CString name ) const; + CPPUNIT_NS::Test *findTestByNameFor( const CString &name, + CPPUNIT_NS::Test *test ) const; void saveHistoryEntry( int idx, CString testName ); @@ -74,7 +74,7 @@ private: protected: History m_history; - CppUnit::Test *m_rootTest; + CPPUNIT_NS::Test *m_rootTest; }; diff --git a/src/msvc6/testrunner/TreeHierarchyDlg.cpp b/src/msvc6/testrunner/TreeHierarchyDlg.cpp index f04ca90..1c0b671 100644 --- a/src/msvc6/testrunner/TreeHierarchyDlg.cpp +++ b/src/msvc6/testrunner/TreeHierarchyDlg.cpp @@ -49,7 +49,7 @@ END_MESSAGE_MAP() void -TreeHierarchyDlg::setRootTest( CppUnit::Test *test ) +TreeHierarchyDlg::setRootTest( CPPUNIT_NS::Test *test ) { m_rootTest = test; } @@ -93,7 +93,7 @@ TreeHierarchyDlg::fillTree() HTREEITEM -TreeHierarchyDlg::addTest( CppUnit::Test *test, +TreeHierarchyDlg::addTest( CPPUNIT_NS::Test *test, HTREEITEM hParent ) { int testType = isSuite( test ) ? imgSuite : imgUnitTest; @@ -112,7 +112,7 @@ TreeHierarchyDlg::addTest( CppUnit::Test *test, void -TreeHierarchyDlg::addTestSuiteChildrenTo( CppUnit::Test *suite, +TreeHierarchyDlg::addTestSuiteChildrenTo( CPPUNIT_NS::Test *suite, HTREEITEM hItemSuite ) { Tests tests; @@ -127,7 +127,7 @@ TreeHierarchyDlg::addTestSuiteChildrenTo( CppUnit::Test *suite, bool -TreeHierarchyDlg::isSuite( CppUnit::Test *test ) +TreeHierarchyDlg::isSuite( CPPUNIT_NS::Test *test ) { return ( test->getChildTestCount() > 0 || // suite with test test->countTestCases() == 0 ); // empty suite @@ -136,7 +136,7 @@ TreeHierarchyDlg::isSuite( CppUnit::Test *test ) struct PredSortTest { - bool operator()( CppUnit::Test *test1, CppUnit::Test *test2 ) const + bool operator()( CPPUNIT_NS::Test *test1, CPPUNIT_NS::Test *test2 ) const { bool isTest1Suite = TreeHierarchyDlg::isSuite( test1 ); bool isTest2Suite = TreeHierarchyDlg::isSuite( test2 ); @@ -158,7 +158,7 @@ TreeHierarchyDlg::sortByName( Tests &tests ) const void TreeHierarchyDlg::OnOK() { - CppUnit::Test *test = findSelectedTest(); + CPPUNIT_NS::Test *test = findSelectedTest(); if ( test == NULL ) { AfxMessageBox( loadCString(IDS_ERROR_SELECT_TEST), MB_OK ); @@ -179,7 +179,7 @@ TreeHierarchyDlg::OnCancel() } -CppUnit::Test * +CPPUNIT_NS::Test * TreeHierarchyDlg::findSelectedTest() { HTREEITEM hItem = m_treeTests.GetSelectedItem(); @@ -187,13 +187,13 @@ TreeHierarchyDlg::findSelectedTest() { DWORD data; VERIFY( data = m_treeTests.GetItemData( hItem ) ); - return reinterpret_cast<CppUnit::Test *>( data ); + return reinterpret_cast<CPPUNIT_NS::Test *>( data ); } return NULL; } -CppUnit::Test * +CPPUNIT_NS::Test * TreeHierarchyDlg::getSelectedTest() const { return m_selectedTest; diff --git a/src/msvc6/testrunner/TreeHierarchyDlg.h b/src/msvc6/testrunner/TreeHierarchyDlg.h index 70524d2..b49126a 100644 --- a/src/msvc6/testrunner/TreeHierarchyDlg.h +++ b/src/msvc6/testrunner/TreeHierarchyDlg.h @@ -21,10 +21,10 @@ class TreeHierarchyDlg : public cdxCDynamicDialog public: TreeHierarchyDlg(CWnd* pParent = NULL); // standard constructor - void setRootTest( CppUnit::Test *test ); - CppUnit::Test *getSelectedTest() const; + void setRootTest( CPPUNIT_NS::Test *test ); + CPPUNIT_NS::Test *getSelectedTest() const; - static bool isSuite( CppUnit::Test *test ); + static bool isSuite( CPPUNIT_NS::Test *test ); // Dialog Data //{{AFX_DATA(TreeHierarchyDlg) @@ -53,16 +53,16 @@ protected: DECLARE_MESSAGE_MAP(); private: - typedef std::vector<CppUnit::Test *> Tests; + typedef std::vector<CPPUNIT_NS::Test *> Tests; void fillTree(); - HTREEITEM addTest( CppUnit::Test *test, + HTREEITEM addTest( CPPUNIT_NS::Test *test, HTREEITEM hParent ); - void addTestSuiteChildrenTo( CppUnit::Test *suite, + void addTestSuiteChildrenTo( CPPUNIT_NS::Test *suite, HTREEITEM hItemSuite ); void sortByName( Tests &tests ) const; - CppUnit::Test *findSelectedTest(); + CPPUNIT_NS::Test *findSelectedTest(); enum { @@ -71,8 +71,8 @@ private: }; CImageList m_imageList; - CppUnit::Test *m_selectedTest; - CppUnit::Test *m_rootTest; + CPPUNIT_NS::Test *m_selectedTest; + CPPUNIT_NS::Test *m_rootTest; }; //{{AFX_INSERT_LOCATION}} diff --git a/src/qttestrunner/MostRecentTests.cpp b/src/qttestrunner/MostRecentTests.cpp index 5bb3c43..e286ed1 100644 --- a/src/qttestrunner/MostRecentTests.cpp +++ b/src/qttestrunner/MostRecentTests.cpp @@ -18,7 +18,7 @@ MostRecentTests::~MostRecentTests() void -MostRecentTests::setTestToRun( CppUnit::Test *test ) +MostRecentTests::setTestToRun( CPPUNIT_NS::Test *test ) { m_tests.removeRef( test ); m_tests.prepend( test ); @@ -32,7 +32,7 @@ MostRecentTests::setTestToRun( CppUnit::Test *test ) } -CppUnit::Test * +CPPUNIT_NS::Test * MostRecentTests::testToRun() { return testAt( 0 ); @@ -61,7 +61,7 @@ MostRecentTests::testNameAt( int index ) } -CppUnit::Test * +CPPUNIT_NS::Test * MostRecentTests::testAt( int index ) { return m_tests.at( index ); diff --git a/src/qttestrunner/MostRecentTests.h b/src/qttestrunner/MostRecentTests.h index ac17de8..39cb4d1 100644 --- a/src/qttestrunner/MostRecentTests.h +++ b/src/qttestrunner/MostRecentTests.h @@ -27,16 +27,16 @@ public: */ virtual ~MostRecentTests(); - void setTestToRun( CppUnit::Test *test ); - CppUnit::Test *testToRun(); + void setTestToRun( CPPUNIT_NS::Test *test ); + CPPUNIT_NS::Test *testToRun(); int testCount(); QString testNameAt( int index ); - CppUnit::Test *testAt( int index ); + CPPUNIT_NS::Test *testAt( int index ); signals: void listChanged(); - void testToRunChanged( CppUnit::Test *testToRun ); + void testToRunChanged( CPPUNIT_NS::Test *testToRun ); public slots: void selectTestToRun( int index ); @@ -49,7 +49,7 @@ private: void operator =( const MostRecentTests © ); private: - QList<CppUnit::Test> m_tests; + QList<CPPUNIT_NS::Test> m_tests; }; diff --git a/src/qttestrunner/TestRunner.cpp b/src/qttestrunner/QtTestRunner.cpp index 98ffcba..9f203cd 100644 --- a/src/qttestrunner/TestRunner.cpp +++ b/src/qttestrunner/QtTestRunner.cpp @@ -1,30 +1,26 @@ // ////////////////////////////////////////////////////////////////////////// -// Implementation file TestRunner.cpp for class TestRunner +// Implementation file QtTestRunner.cpp for class QtTestRunner // (c)Copyright 2000, Baptiste Lepilleur. // Created: 2001/09/19 // ////////////////////////////////////////////////////////////////////////// #include <qapplication.h> #include <cppunit/TestSuite.h> -#include <cppunit/ui/qt/TestRunner.h> +#include <cppunit/ui/qt/QtTestRunner.h> #include "TestRunnerDlgImpl.h" #include "TestRunnerModel.h" -namespace CppUnit -{ - namespace QtUi - { - +CPPUNIT_NS_BEGIN -TestRunner::TestRunner() : - _suite( new CppUnit::TestSuite( "All Tests" ) ), +QtTestRunner::QtTestRunner() : + _suite( new CPPUNIT_NS::TestSuite( "All Tests" ) ), _tests( new Tests() ) { } -TestRunner::~TestRunner() +QtTestRunner::~QtTestRunner() { delete _suite; @@ -37,7 +33,7 @@ TestRunner::~TestRunner() Test * -TestRunner::getRootTest() +QtTestRunner::getRootTest() { if ( _tests->size() != 1 ) { @@ -52,10 +48,10 @@ TestRunner::getRootTest() void -TestRunner::run( bool autoRun ) +QtTestRunner::run( bool autoRun ) { TestRunnerDlg *dlg = new TestRunnerDlg( qApp->mainWidget(), - "TestRunner", + "QtTestRunner", TRUE ); dlg->setModel( new TestRunnerModel( getRootTest() ), autoRun ); @@ -65,11 +61,10 @@ TestRunner::run( bool autoRun ) void -TestRunner::addTest( CppUnit::Test *test ) +QtTestRunner::addTest( CPPUNIT_NS::Test *test ) { _tests->push_back( test ); } - } // namespace QtUi -} // namespace CppUnit +CPPUNIT_NS_END diff --git a/src/qttestrunner/QtTestRunnerDll.pro b/src/qttestrunner/QtTestRunnerDll.pro index 3477f60..3d6c2d4 100644 --- a/src/qttestrunner/QtTestRunnerDll.pro +++ b/src/qttestrunner/QtTestRunnerDll.pro @@ -26,7 +26,7 @@ SOURCES = MostRecentTests.cpp \ TestFailureInfo.cpp \ TestFailureListViewItem.cpp \ TestListViewItem.cpp \ - TestRunner.cpp \ + QtTestRunner.cpp \ TestRunnerDlgImpl.cpp \ TestRunnerFailureEvent.cpp \ TestRunnerModel.cpp \ diff --git a/src/qttestrunner/TestBrowserDlgImpl.cpp b/src/qttestrunner/TestBrowserDlgImpl.cpp index b41e8e9..cef7c52 100644 --- a/src/qttestrunner/TestBrowserDlgImpl.cpp +++ b/src/qttestrunner/TestBrowserDlgImpl.cpp @@ -29,7 +29,7 @@ TestBrowser::~TestBrowser() void -TestBrowser::setRootTest( CppUnit::Test *rootTest ) +TestBrowser::setRootTest( CPPUNIT_NS::Test *rootTest ) { QListViewItem *dummyRoot = new QListViewItem( _listTests ); @@ -44,7 +44,7 @@ TestBrowser::setRootTest( CppUnit::Test *rootTest ) void -TestBrowser::insertItemFor( CppUnit::Test *test, +TestBrowser::insertItemFor( CPPUNIT_NS::Test *test, QListViewItem *parentItem ) { QListViewItem *item = new TestListViewItem( test, parentItem ); @@ -59,7 +59,7 @@ TestBrowser::insertItemFor( CppUnit::Test *test, } -CppUnit::Test * +CPPUNIT_NS::Test * TestBrowser::selectedTest() { return _selectedTest; diff --git a/src/qttestrunner/TestBrowserDlgImpl.h b/src/qttestrunner/TestBrowserDlgImpl.h index f2c8767..d4c113a 100644 --- a/src/qttestrunner/TestBrowserDlgImpl.h +++ b/src/qttestrunner/TestBrowserDlgImpl.h @@ -14,19 +14,19 @@ public: TestBrowser( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~TestBrowser(); - void setRootTest( CppUnit::Test *rootTest ); + void setRootTest( CPPUNIT_NS::Test *rootTest ); - CppUnit::Test *selectedTest(); + CPPUNIT_NS::Test *selectedTest(); protected slots: void accept(); private: - void insertItemFor( CppUnit::Test *test, - QListViewItem *parentItem ); + void insertItemFor( CPPUNIT_NS::Test *test, + QListViewItem *parentItem ); private: - CppUnit::Test *_selectedTest; + CPPUNIT_NS::Test *_selectedTest; }; #endif // TESTBROWSER_H diff --git a/src/qttestrunner/TestFailureInfo.cpp b/src/qttestrunner/TestFailureInfo.cpp index 2cc6b87..54c5b1d 100644 --- a/src/qttestrunner/TestFailureInfo.cpp +++ b/src/qttestrunner/TestFailureInfo.cpp @@ -8,10 +8,10 @@ #include <cppunit/Exception.h> -TestFailureInfo::TestFailureInfo( CppUnit::Test *failedTest, - CppUnit::Exception *thrownException, +TestFailureInfo::TestFailureInfo( CPPUNIT_NS::Test *failedTest, + CPPUNIT_NS::Exception *thrownException, bool isError ) : - CppUnit::TestFailure( failedTest, thrownException->clone(), isError ) + CPPUNIT_NS::TestFailure( failedTest, thrownException->clone(), isError ) { } diff --git a/src/qttestrunner/TestFailureInfo.h b/src/qttestrunner/TestFailureInfo.h index f51d8a7..64a2ceb 100644 --- a/src/qttestrunner/TestFailureInfo.h +++ b/src/qttestrunner/TestFailureInfo.h @@ -12,13 +12,13 @@ /*! \class TestFailureInfo * \brief This class represents a test failure. */ -class TestFailureInfo : public CppUnit::TestFailure +class TestFailureInfo : public CPPUNIT_NS::TestFailure { public: /*! Constructs a TestFailureInfo object. */ - TestFailureInfo( CppUnit::Test *failedTest, - CppUnit::Exception *thrownException, + TestFailureInfo( CPPUNIT_NS::Test *failedTest, + CPPUNIT_NS::Exception *thrownException, bool isError ); /*! Destructor. diff --git a/src/qttestrunner/TestListViewItem.cpp b/src/qttestrunner/TestListViewItem.cpp index 6dac873..b4032dc 100644 --- a/src/qttestrunner/TestListViewItem.cpp +++ b/src/qttestrunner/TestListViewItem.cpp @@ -7,7 +7,7 @@ #include "TestListViewItem.h" -TestListViewItem::TestListViewItem( CppUnit::Test *test, +TestListViewItem::TestListViewItem( CPPUNIT_NS::Test *test, QListViewItem *parent ) : QListViewItem( parent ), _test( test ) @@ -20,7 +20,7 @@ TestListViewItem::~TestListViewItem() } -CppUnit::Test * +CPPUNIT_NS::Test * TestListViewItem::test() const { return _test; diff --git a/src/qttestrunner/TestListViewItem.h b/src/qttestrunner/TestListViewItem.h index 5541b02..4032f68 100644 --- a/src/qttestrunner/TestListViewItem.h +++ b/src/qttestrunner/TestListViewItem.h @@ -18,14 +18,14 @@ class TestListViewItem : public QListViewItem public: /*! Constructs a TestListViewItem object. */ - TestListViewItem( CppUnit::Test *test, + TestListViewItem( CPPUNIT_NS::Test *test, QListViewItem *parent ); /*! Destructor. */ virtual ~TestListViewItem(); - CppUnit::Test *test() const; + CPPUNIT_NS::Test *test() const; private: /// Prevents the use of the copy constructor. @@ -35,14 +35,9 @@ private: void operator =( const TestListViewItem © ); private: - CppUnit::Test *_test; + CPPUNIT_NS::Test *_test; }; -// Inlines methods for TestListViewItem: -// ------------------------------------- - - - #endif // TESTLISTVIEWITEM_H diff --git a/src/qttestrunner/TestRunnerDlgImpl.cpp b/src/qttestrunner/TestRunnerDlgImpl.cpp index bf40b53..d00616c 100644 --- a/src/qttestrunner/TestRunnerDlgImpl.cpp +++ b/src/qttestrunner/TestRunnerDlgImpl.cpp @@ -55,8 +55,8 @@ TestRunnerDlg::setModel( TestRunnerModel *model, _recentTests, SLOT( selectTestToRun(int) ) ); // refresh the test report counters when a test is selected - connect( _recentTests, SIGNAL( testToRunChanged(CppUnit::Test *) ), - _model, SLOT( resetTestReportCounterFor(CppUnit::Test *) ) ); + connect( _recentTests, SIGNAL( testToRunChanged(CPPUNIT_NS::Test *) ), + _model, SLOT( resetTestReportCounterFor(CPPUNIT_NS::Test *) ) ); // refresh progress bar connect( _model, SIGNAL( numberOfTestCaseChanged(int) ), @@ -89,7 +89,7 @@ TestRunnerDlg::setModel( TestRunnerModel *model, SLOT( showFailureDetailAt(QListViewItem*) ) ); // disable button when running test - connect( _model, SIGNAL( testRunStarted( CppUnit::Test *, CppUnit::TestResult *) ), + connect( _model, SIGNAL( testRunStarted( CPPUNIT_NS::Test *, CPPUNIT_NS::TestResult *) ), SLOT( beRunningTest() ) ); // enable button when finished running test @@ -122,7 +122,7 @@ TestRunnerDlg::browseForTest() void TestRunnerDlg::runTest() { - CppUnit::Test *testToRun = _recentTests->testToRun(); + CPPUNIT_NS::Test *testToRun = _recentTests->testToRun(); if ( testToRun == NULL ) return; _model->runTest( testToRun ); @@ -185,7 +185,7 @@ TestRunnerDlg::reportFailure( TestFailureInfo *failure ) std::string failedtestName = failure->failedTestName().c_str(); item->setText( indexTestName, QString::fromLatin1( failedtestName.c_str() ) ); - CppUnit::Exception *thrownException = failure->thrownException(); + CPPUNIT_NS::Exception *thrownException = failure->thrownException(); item->setText( indexMessage, thrownException->what() ); item->setText( indexFilename, failure->sourceLine().fileName().c_str() ); item->setText( indexLineNumber, diff --git a/src/qttestrunner/TestRunnerModel.cpp b/src/qttestrunner/TestRunnerModel.cpp index ed32302..7058101 100644 --- a/src/qttestrunner/TestRunnerModel.cpp +++ b/src/qttestrunner/TestRunnerModel.cpp @@ -12,7 +12,7 @@ #include "TestRunnerThreadFinishedEvent.h" -TestRunnerModel::TestRunnerModel( CppUnit::Test *rootTest ) : +TestRunnerModel::TestRunnerModel( CPPUNIT_NS::Test *rootTest ) : _rootTest( rootTest ), _runnerThread( NULL ), _result( NULL ) @@ -26,7 +26,7 @@ TestRunnerModel::~TestRunnerModel() } -CppUnit::Test * +CPPUNIT_NS::Test * TestRunnerModel::rootTest() { return _rootTest; @@ -34,7 +34,7 @@ TestRunnerModel::rootTest() void -TestRunnerModel::resetTestReportCounterFor( CppUnit::Test *testToRun ) +TestRunnerModel::resetTestReportCounterFor( CPPUNIT_NS::Test *testToRun ) { if ( isTestRunning() ) return; @@ -87,7 +87,7 @@ TestRunnerModel::failureAt( int index ) void -TestRunnerModel::runTest( CppUnit::Test *testToRun ) +TestRunnerModel::runTest( CPPUNIT_NS::Test *testToRun ) { if ( isTestRunning() ) return; @@ -97,7 +97,7 @@ TestRunnerModel::runTest( CppUnit::Test *testToRun ) { LockGuard guard( _lock ); delete _result; - _result = new CppUnit::TestResult(); + _result = new CPPUNIT_NS::TestResult(); _result->addListener( this ); } @@ -137,14 +137,14 @@ TestRunnerModel::stopRunningTest() // Called from the TestRunnerThread. void -TestRunnerModel::startTest( CppUnit::Test *test ) +TestRunnerModel::startTest( CPPUNIT_NS::Test *test ) { } // Called from the TestRunnerThread. void -TestRunnerModel::addFailure( const CppUnit::TestFailure &failure ) +TestRunnerModel::addFailure( const CPPUNIT_NS::TestFailure &failure ) { addFailureInfo( new TestFailureInfo( failure.failedTest(), failure.thrownException(), @@ -154,7 +154,7 @@ TestRunnerModel::addFailure( const CppUnit::TestFailure &failure ) // Called from the TestRunnerThread. void -TestRunnerModel::endTest( CppUnit::Test *test ) +TestRunnerModel::endTest( CPPUNIT_NS::Test *test ) { int numberOfTestCaseRun; { diff --git a/src/qttestrunner/TestRunnerModel.h b/src/qttestrunner/TestRunnerModel.h index 1d73a72..a9893dc 100644 --- a/src/qttestrunner/TestRunnerModel.h +++ b/src/qttestrunner/TestRunnerModel.h @@ -28,20 +28,20 @@ class TestRunnerThread; * TestResult. */ class TestRunnerModel : public QObject, - private CppUnit::TestListener, + private CPPUNIT_NS::TestListener, private TestRunnerModelThreadInterface { Q_OBJECT public: /*! Constructs a TestRunnerModel object. */ - TestRunnerModel( CppUnit::Test *rootTest ); + TestRunnerModel( CPPUNIT_NS::Test *rootTest ); /*! Destructor. */ virtual ~TestRunnerModel(); - CppUnit::Test *rootTest(); + CPPUNIT_NS::Test *rootTest(); int numberOfTestCase(); int numberOfTestCaseFailure(); @@ -58,18 +58,18 @@ signals: void numberOfTestCaseFailureChanged( int numberOfFailure ); void failureAdded( TestFailureInfo *failure ); void failuresCleared(); - void testRunStarted( CppUnit::Test *runningTest, - CppUnit::TestResult *result ); + void testRunStarted( CPPUNIT_NS::Test *runningTest, + CPPUNIT_NS::TestResult *result ); void testRunFinished(); public slots: - void resetTestReportCounterFor( CppUnit::Test *testToRun ); + void resetTestReportCounterFor( CPPUNIT_NS::Test *testToRun ); /*! Request to run the specified test. * Returns immedialty. If a test is already running, then * the run request is ignored. */ - void runTest( CppUnit::Test *testToRun ); + void runTest( CPPUNIT_NS::Test *testToRun ); /*! Request to stop running test. * This methods returns immediately. testRunFinished() signal @@ -85,13 +85,13 @@ private: void operator =( const TestRunnerModel © ); /// Called from the TestRunnerThread. - void startTest( CppUnit::Test *test ); + void startTest( CPPUNIT_NS::Test *test ); /// Called from the TestRunnerThread. - void addFailure( const CppUnit::TestFailure &failure ); + void addFailure( const CPPUNIT_NS::TestFailure &failure ); /// Called from the TestRunnerThread. - void endTest( CppUnit::Test *test ); + void endTest( CPPUNIT_NS::Test *test ); /// Called from the TestRunnerThread. void addFailureInfo( TestFailureInfo *failure ); @@ -135,13 +135,13 @@ private: QMutex _lock; - CppUnit::Test *_rootTest; + CPPUNIT_NS::Test *_rootTest; int _numberOfTestCase; int _numberOfTestCaseRun; int _numberOfTestCaseFailure; QList<TestFailureInfo> _failures; TestRunnerThread *_runnerThread; - CppUnit::TestResult *_result; + CPPUNIT_NS::TestResult *_result; }; diff --git a/src/qttestrunner/TestRunnerThread.cpp b/src/qttestrunner/TestRunnerThread.cpp index 160562a..cc45526 100644 --- a/src/qttestrunner/TestRunnerThread.cpp +++ b/src/qttestrunner/TestRunnerThread.cpp @@ -8,8 +8,8 @@ #include "TestRunnerThreadFinishedEvent.h" -TestRunnerThread::TestRunnerThread( CppUnit::Test *testToRun, - CppUnit::TestResult *result, +TestRunnerThread::TestRunnerThread( CPPUNIT_NS::Test *testToRun, + CPPUNIT_NS::TestResult *result, QObject *eventTarget, TestRunnerThreadFinishedEvent *finishedEvent ) : _testToRun( testToRun ), diff --git a/src/qttestrunner/TestRunnerThread.h b/src/qttestrunner/TestRunnerThread.h index 5c948e4..54cb4f1 100644 --- a/src/qttestrunner/TestRunnerThread.h +++ b/src/qttestrunner/TestRunnerThread.h @@ -21,8 +21,8 @@ class TestRunnerThread : public QThread public: /*! Constructs a TestRunnerThread object. */ - TestRunnerThread( CppUnit::Test *testToRun, - CppUnit::TestResult *result, + TestRunnerThread( CPPUNIT_NS::Test *testToRun, + CPPUNIT_NS::TestResult *result, QObject *eventTarget, TestRunnerThreadFinishedEvent *finishedEvent ); @@ -39,8 +39,8 @@ private: void run(); private: - CppUnit::Test *_testToRun; - CppUnit::TestResult *_result; + CPPUNIT_NS::Test *_testToRun; + CPPUNIT_NS::TestResult *_result; QObject *_eventTarget; TestRunnerThreadFinishedEvent *_finishedEvent; }; diff --git a/src/qttestrunner/qttestrunner.pro b/src/qttestrunner/qttestrunner.pro index c7c82ab..2a52339 100644 --- a/src/qttestrunner/qttestrunner.pro +++ b/src/qttestrunner/qttestrunner.pro @@ -21,7 +21,7 @@ SOURCES = MostRecentTests.cpp \ TestFailureInfo.cpp \ TestFailureListViewItem.cpp \ TestListViewItem.cpp \ - TestRunner.cpp \ + QtTestRunner.cpp \ TestRunnerDlgImpl.cpp \ TestRunnerFailureEvent.cpp \ TestRunnerModel.cpp \ |
