diff options
| author | Baptiste Lepilleur <gaiacrtn@free.fr> | 2002-04-12 18:28:48 +0000 |
|---|---|---|
| committer | Baptiste Lepilleur <gaiacrtn@free.fr> | 2002-04-12 18:28:48 +0000 |
| commit | ed406a2966e62072fa6afaca8abc578db7c0c9fb (patch) | |
| tree | ab8d2ffb462c3c955b2e339e8cc19f1a6be8bd0f /examples/cppunittest | |
| parent | fc9c76622b19adfcdebce682d9d49db8fb9336ef (diff) | |
| download | cppunit-ed406a2966e62072fa6afaca8abc578db7c0c9fb.tar.gz | |
Makefile.
Makefile.am: added examples/qt to tar ball release.
* TODO: heavily updated.
* contrib/msvc/CppUnit*.wwtpl: changed base class for unit test to TestFixture.
* include/cppunit/Test.h: removed toString() method. Not used by the framework
and source of confusions with getName().
Added getChildTestCount() and getChildTestAt(), introducing the composite pattern
at top level. Added utility methods findTest() and findTestPath().
* src/cppunit/Test.cpp: added. Implementation of new utility methods.
* include/cppunit/TestCase.h:
* src/cppunit/TestCase.cpp: inherits TestLeaf. Removed toString(), run(void) and
defaultResult(). Removed default constructor.
* src/cppunit/TestCase.cpp:
* src/cppunit/TestSuite.cpp: fixed some includes that used "" instead of <>.
* include/cppunit/TestComposite.h:
* src/cppunit/TestComposite.cpp: added. Common implementation of Test for composite
tests (TestSuite).
* include/cppunit/TestFailure.h:
* src/cppunit/TestFailure.cpp: removed toString().
* include/cppunit/TestLeaf.h:
* src/cppunit/TestLeaf.cpp: added. Common implementation of Test for single test
(TestCase).
* include/cppunit/TestListener.h: added TimingListener example to documentation.
* include/cppunit/TestPath.h:
* src/cppunit/TestPath.cpp: added. List of test traversed to access a test in the
test hierarchy.
* include/cppunit/TestRunner.h: added. Generic TestRunner.
* src/cppunit/TestRunner.cpp: moved to TextTestRunner.cpp. Added new implementation
of includecppunit/TestRunner.h.
* include/cppunit/TestSuite.h:
* src/cppunit/TestSuite.cpp: inherits TestComposite and implements new Test
interface. Removed toString().
* src/cppunit/TextTestRunner.cpp: moved from TestRunner.cpp. Implementation of
include/cppunit/ui/text/TestRunner.h.
* include/cppunit/extensions/RepeatedTest.h:
* src/cppunit/RepeatedTest.cpp: removed toString().
* include/cppunit/extensions/TestDecorator.h: inherits TestLeaf.
Removed toString()
* include/cppunit/XmlOutputter.h:
* src/cppunit/XmlOutputter.cpp:
* examples/cppunittest/XmlOutputterTest.cpp:
* examples/cppunittest/XmlOutputterTest.h: XML outputter now escape node content.
Add unit test for that bug (#540944). Added style sheet support. Modified
XML structure: failure message as its own element.
* src/msvc/testrunner/TestRunnerModel.h:
* src/msvc/testrunner/TestRunnerModel.cpp: used Test::findTest() to find a test
by name instead of using RTTI. Added toAnsiString() for convertion when
compiling as UNICODE.
* src/msvc/testrunner/TreeHierarchyDlg.h:
* src/msvc/testrunner/TreeHierarchyDlg.cpp: used new composite interface of Test
to explorer the test hierarchy instead of RTTI.
* examples/cppunittest/TestPathTest.h:
* examples/cppunittest/TestPathTest.cpp: added, unit tests for TestPath.
* examples/cppunittest/TestCaseTest.h:
* examples/cppunittest/TestCaseTest.cpp: added test for TestLeaf.
* examples/cppunittest/TestSuiteTest.h:
* examples/cppunittest/TestSuiteTest.cpp: added test for TestComposite and
new Test interface.
Diffstat (limited to 'examples/cppunittest')
| -rw-r--r-- | examples/cppunittest/CppUnitTestMain.cpp | 61 | ||||
| -rw-r--r-- | examples/cppunittest/CppUnitTestMain.dsp | 26 | ||||
| -rw-r--r-- | examples/cppunittest/Makefile.am | 4 | ||||
| -rw-r--r-- | examples/cppunittest/MockTestCase.cpp | 16 | ||||
| -rw-r--r-- | examples/cppunittest/MockTestCase.h | 4 | ||||
| -rw-r--r-- | examples/cppunittest/TestCaseTest.cpp | 29 | ||||
| -rw-r--r-- | examples/cppunittest/TestCaseTest.h | 11 | ||||
| -rw-r--r-- | examples/cppunittest/TestPathTest.cpp | 490 | ||||
| -rw-r--r-- | examples/cppunittest/TestPathTest.h | 142 | ||||
| -rw-r--r-- | examples/cppunittest/TestSuiteTest.cpp | 37 | ||||
| -rw-r--r-- | examples/cppunittest/TestSuiteTest.h | 10 | ||||
| -rw-r--r-- | examples/cppunittest/TestTest.cpp | 133 | ||||
| -rw-r--r-- | examples/cppunittest/TestTest.h | 67 | ||||
| -rw-r--r-- | examples/cppunittest/TrackedTestCase.cpp | 1 | ||||
| -rw-r--r-- | examples/cppunittest/XmlOutputterTest.cpp | 25 | ||||
| -rw-r--r-- | examples/cppunittest/XmlOutputterTest.h | 2 |
16 files changed, 1008 insertions, 50 deletions
diff --git a/examples/cppunittest/CppUnitTestMain.cpp b/examples/cppunittest/CppUnitTestMain.cpp index db7b5bd..76f255d 100644 --- a/examples/cppunittest/CppUnitTestMain.cpp +++ b/examples/cppunittest/CppUnitTestMain.cpp @@ -1,32 +1,51 @@ -#include <cppunit/extensions/TestFactoryRegistry.h> #include <cppunit/CompilerOutputter.h> -#include <cppunit/ui/text/TestRunner.h> +#include <cppunit/TestResult.h> +#include <cppunit/TestResultCollector.h> +#include <cppunit/TestRunner.h> +#include <cppunit/TextTestProgressListener.h> #include "CppUnitTestSuite.h" int main( int argc, char* argv[] ) { - // if command line contains "-selftest" then this is the post build check - // => the output must be in the compiler error format. - bool selfTest = (argc > 1) && - (std::string("-selftest") == argv[1]); - - CppUnit::TextUi::TestRunner runner; - runner.addTest( CppUnitTest::suite() ); // Add the top suite to the test runner - - if ( selfTest ) - { // Change the default outputter to a compiler error format outputter - // The test runner owns the new outputter. - runner.setOutputter( CppUnit::CompilerOutputter::defaultOutputter( - &runner.result(), - std::cerr ) ); - } + // Retreive test path from command line first argument. Default to "" which resolve + // to the top level suite. + std::string testPath = (argc > 1) ? std::string(argv[1]) : ""; + + // Create the event manager and test controller + CppUnit::TestResult controller; + + // Add a listener that colllects test result + CppUnit::TestResultCollector result; + controller.addListener( &result ); + + // Add a listener that print dots as test run. + CppUnit::TextTestProgressListener progress; + controller.addListener( &progress ); - // Run the test. - bool wasSucessful = runner.run( "" ); + // Add the top suite to the test runner + CppUnit::TestRunner runner; + runner.addTest( CppUnitTest::suite() ); + try + { + std::cout << "Running " << testPath; + runner.run( controller, testPath ); + + std::cerr << std::endl; + + // Print test in a compiler compatible format. + CppUnit::CompilerOutputter outputter( &result, std::cerr ); + outputter.write(); + } + catch ( std::invalid_argument &e ) // Test path not resolved + { + std::cerr << std::endl + << "ERROR: " << e.what() + << std::endl; + return 0; + } - // Return error code 1 if the one of test failed. - return wasSucessful ? 0 : 1; + return result.wasSuccessful() ? 0 : 1; } diff --git a/examples/cppunittest/CppUnitTestMain.dsp b/examples/cppunittest/CppUnitTestMain.dsp index 73d8f7f..a566429 100644 --- a/examples/cppunittest/CppUnitTestMain.dsp +++ b/examples/cppunittest/CppUnitTestMain.dsp @@ -59,7 +59,7 @@ LINK32=link.exe TargetPath=.\Release\CppUnitTestMain.exe SOURCE="$(InputPath)" PostBuild_Desc=Self test -PostBuild_Cmds=$(TargetPath) -selftest +PostBuild_Cmds=$(TargetPath) # End Special Build Tool !ELSEIF "$(CFG)" == "CppUnitTestMain - Win32 Debug" @@ -90,7 +90,7 @@ LINK32=link.exe TargetPath=.\Debug\CppUnitTestMain.exe SOURCE="$(InputPath)" PostBuild_Desc=Self test -PostBuild_Cmds=$(TargetPath) -selftest +PostBuild_Cmds=$(TargetPath) # End Special Build Tool !ELSEIF "$(CFG)" == "CppUnitTestMain - Win32 Debug Crossplatform Setting" @@ -123,7 +123,7 @@ LINK32=link.exe TargetPath=.\DebugCrossplatform\CppUnitTestMain.exe SOURCE="$(InputPath)" PostBuild_Desc=Self test -PostBuild_Cmds=$(TargetPath) -selftest +PostBuild_Cmds=$(TargetPath) # End Special Build Tool !ELSEIF "$(CFG)" == "CppUnitTestMain - Win32 Release DLL" @@ -156,7 +156,7 @@ LINK32=link.exe TargetPath=.\ReleaseDLL\CppUnitTestMain.exe SOURCE="$(InputPath)" PostBuild_Desc=Self test -PostBuild_Cmds=$(TargetPath) -selftest +PostBuild_Cmds=$(TargetPath) # End Special Build Tool !ELSEIF "$(CFG)" == "CppUnitTestMain - Win32 Debug DLL" @@ -189,7 +189,7 @@ LINK32=link.exe TargetPath=.\DebugDLL\CppUnitTestMain.exe SOURCE="$(InputPath)" PostBuild_Desc=Self test -PostBuild_Cmds=$(TargetPath) -selftest +PostBuild_Cmds=$(TargetPath) # End Special Build Tool !ENDIF @@ -257,6 +257,14 @@ SOURCE=.\TestFailureTest.h # End Source File # Begin Source File +SOURCE=.\TestPathTest.cpp +# End Source File +# Begin Source File + +SOURCE=.\TestPathTest.h +# End Source File +# Begin Source File + SOURCE=.\TestResultTest.cpp # End Source File # Begin Source File @@ -271,6 +279,14 @@ SOURCE=.\TestSuiteTest.cpp SOURCE=.\TestSuiteTest.h # End Source File +# Begin Source File + +SOURCE=.\TestTest.cpp +# End Source File +# Begin Source File + +SOURCE=.\TestTest.h +# End Source File # End Group # Begin Group "UnitTestTools" diff --git a/examples/cppunittest/Makefile.am b/examples/cppunittest/Makefile.am index 8903c62..bae0a8c 100644 --- a/examples/cppunittest/Makefile.am +++ b/examples/cppunittest/Makefile.am @@ -43,6 +43,8 @@ cppunittestmain_SOURCES = \ TestDecoratorTest.h \ TestFailureTest.cpp \ TestFailureTest.h \ + TestPathTest.h \ + TestPathTest.cpp \ TestResultCollectorTest.cpp \ TestResultCollectorTest.h \ TestResultTest.cpp \ @@ -51,6 +53,8 @@ cppunittestmain_SOURCES = \ TestSetUpTest.h \ TestSuiteTest.cpp \ TestSuiteTest.h \ + TestTest.cpp \ + TestTest.h \ TrackedTestCase.cpp \ TrackedTestCase.h \ UnitTestToolSuite.h \ diff --git a/examples/cppunittest/MockTestCase.cpp b/examples/cppunittest/MockTestCase.cpp index 6561ff4..84f10dd 100644 --- a/examples/cppunittest/MockTestCase.cpp +++ b/examples/cppunittest/MockTestCase.cpp @@ -1,5 +1,6 @@ #include "FailureException.h" #include "MockTestCase.h" +#include <cppunit/TestPath.h> MockTestCase::MockTestCase( std::string name ) @@ -19,6 +20,7 @@ MockTestCase::MockTestCase( std::string name ) , m_setUpThrow( false ) , m_tearDownThrow( false ) , m_runTestThrow( false ) + , m_passingTest( NULL ) { } @@ -85,6 +87,20 @@ MockTestCase::runTest() throw FailureException(); } +/* +bool +MockTestCase::findTestPath( const CppUnit::Test *test, + CppUnit::TestPath &testPath ) +{ + if ( m_passingTest == test ) + { + testPath.add( this ); + return true; + } + + return false; +} +*/ void MockTestCase::setExpectedSetUpCall( int callCount ) diff --git a/examples/cppunittest/MockTestCase.h b/examples/cppunittest/MockTestCase.h index 9cd601c..5043edd 100644 --- a/examples/cppunittest/MockTestCase.h +++ b/examples/cppunittest/MockTestCase.h @@ -27,6 +27,7 @@ public: void makeSetUpThrow(); void makeTearDownThrow(); void makeRunTestThrow(); + void makeFindTestPathPassFor( const CppUnit::Test *testFound ); void verify(); @@ -35,6 +36,8 @@ protected: void setUp(); void tearDown(); void runTest(); +// bool findTestPath( const CppUnit::Test *test, +// CppUnit::TestPath &testPath ); private: /// Prevents the use of the copy constructor. @@ -62,6 +65,7 @@ private: bool m_setUpThrow; bool m_tearDownThrow; bool m_runTestThrow; + const CppUnit::Test *m_passingTest; }; diff --git a/examples/cppunittest/TestCaseTest.cpp b/examples/cppunittest/TestCaseTest.cpp index 5479c0e..91a3f22 100644 --- a/examples/cppunittest/TestCaseTest.cpp +++ b/examples/cppunittest/TestCaseTest.cpp @@ -130,19 +130,6 @@ TestCaseTest::testConstructorWithName() void -TestCaseTest::testDefaultRun() -{ - MockTestCase test( "mocktest" ); - test.setExpectedSetUpCall(); - test.setExpectedRunTestCall(); - test.setExpectedTearDownCall(); - - std::auto_ptr<CppUnit::TestResult> result( test.run() ); - test.verify(); -} - - -void TestCaseTest::testTwoRun() { MockTestCase test1( "mocktest1" ); @@ -156,3 +143,19 @@ TestCaseTest::testTwoRun() m_testListener->verify(); } + + +void +TestCaseTest::testGetChildTestCount() +{ + CppUnit::TestCase test( "test" ); + CPPUNIT_ASSERT_EQUAL( 0, test.getChildTestCount() ); +} + + +void +TestCaseTest::testGetChildTestAtThrow() +{ + CppUnit::TestCase test( "test" ); + test.getChildTestAt( 0 ); +} diff --git a/examples/cppunittest/TestCaseTest.h b/examples/cppunittest/TestCaseTest.h index 15acf78..8fb83cc 100644 --- a/examples/cppunittest/TestCaseTest.h +++ b/examples/cppunittest/TestCaseTest.h @@ -9,6 +9,7 @@ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/TestResult.h> #include "MockTestListener.h" +#include <stdexcept> class TestCaseTest : public CppUnit::TestFixture @@ -19,11 +20,12 @@ class TestCaseTest : public CppUnit::TestFixture CPPUNIT_TEST( testTearDownFailure ); CPPUNIT_TEST( testFailAll ); CPPUNIT_TEST( testNoFailure ); - CPPUNIT_TEST( testDefaultRun ); CPPUNIT_TEST( testTwoRun ); CPPUNIT_TEST( testCountTestCases ); CPPUNIT_TEST( testDefaultConstructor ); CPPUNIT_TEST( testConstructorWithName ); + CPPUNIT_TEST( testGetChildTestCount ); + CPPUNIT_TEST_EXCEPTION( testGetChildTestAtThrow, std::out_of_range ); CPPUNIT_TEST_SUITE_END(); public: @@ -31,15 +33,14 @@ public: virtual ~TestCaseTest(); - virtual void setUp(); - virtual void tearDown(); + void setUp(); + void tearDown(); void testSetUpFailure(); void testRunTestFailure(); void testTearDownFailure(); void testFailAll(); void testNoFailure(); - void testDefaultRun(); void testTwoRun(); void testCountTestCases(); @@ -47,6 +48,8 @@ public: void testDefaultConstructor(); void testConstructorWithName(); + void testGetChildTestCount(); + void testGetChildTestAtThrow(); private: TestCaseTest( const TestCaseTest © ); diff --git a/examples/cppunittest/TestPathTest.cpp b/examples/cppunittest/TestPathTest.cpp new file mode 100644 index 0000000..bf89581 --- /dev/null +++ b/examples/cppunittest/TestPathTest.cpp @@ -0,0 +1,490 @@ +#include "CoreSuite.h" +#include "TestPathTest.h" + + +CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( TestPathTest, + CppUnitTest::coreSuiteName() ); + + +TestPathTest::TestPathTest() +{ +} + + +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_suite2->addTest( m_testSuite2a ); + m_suite2->addTest( m_testSuite2b ); + m_suite1->addTest( m_suite2 ); +} + + +void +TestPathTest::tearDown() +{ + delete m_suite1; + delete m_path; + delete m_test4; + delete m_test3; + delete m_test2; + delete m_test1; +} + + +void +TestPathTest::testDefaultConstructor() +{ + CPPUNIT_ASSERT_EQUAL( 0, m_path->getTestCount() ); + CPPUNIT_ASSERT( !m_path->isValid() ); +} + + +void +TestPathTest::testAddTest() +{ + m_path->add( m_test1 ); + CPPUNIT_ASSERT_EQUAL( 1, m_path->getTestCount() ); + CPPUNIT_ASSERT( m_path->isValid() ); + CPPUNIT_ASSERT( m_test1 == m_path->getTestAt(0) ); +} + + +void +TestPathTest::testGetTestAtThrow1() +{ + m_path->getTestAt( 0 ); +} + + +void +TestPathTest::testGetTestAtThrow2() +{ + m_path->add( m_test1 ); + m_path->getTestAt( 1 ); +} + + +void +TestPathTest::testGetChildTest() +{ + m_path->add( m_test1 ); + CPPUNIT_ASSERT( m_test1 == m_path->getChildTest() ); +} + + +void +TestPathTest::testGetChildTestManyTests() +{ + m_path->add( m_test1 ); + m_path->add( m_test2 ); + m_path->add( m_test3 ); + CPPUNIT_ASSERT( m_test3 == m_path->getChildTest() ); +} + + +void +TestPathTest::testGetChildTestThrowIfNotValid() +{ + m_path->getChildTest(); +} + + +void +TestPathTest::testAddPath() +{ + CppUnit::TestPath path; + path.add( m_test2 ); + path.add( m_test3 ); + + m_path->add( m_test1 ); + m_path->add( path ); + + CPPUNIT_ASSERT_EQUAL( 3, m_path->getTestCount() ); + CPPUNIT_ASSERT( m_test1 == m_path->getTestAt(0) ); + CPPUNIT_ASSERT( m_test2 == m_path->getTestAt(1) ); + CPPUNIT_ASSERT( m_test3 == m_path->getTestAt(2) ); +} + + +void +TestPathTest::testAddInvalidPath() +{ + CppUnit::TestPath path; + m_path->add( path ); + + CPPUNIT_ASSERT( !m_path->isValid() ); +} + + +void +TestPathTest::testRemoveTests() +{ + m_path->add( m_test1 ); + m_path->add( m_test2 ); + + m_path->removeTests(); + + CPPUNIT_ASSERT( !m_path->isValid() ); +} + + +void +TestPathTest::testRemoveTest() +{ + m_path->add( m_test1 ); + m_path->add( m_test2 ); + + m_path->removeTest( 0 ); + + CPPUNIT_ASSERT_EQUAL( 1, m_path->getTestCount() ); + CPPUNIT_ASSERT( m_test2 == m_path->getTestAt(0) ); +} + + +void +TestPathTest::testRemoveTestThrow1() +{ + m_path->removeTest( -1 ); +} + + +void +TestPathTest::testRemoveTestThrow2() +{ + m_path->add( m_test1 ); + + m_path->removeTest( 1 ); +} + + +void +TestPathTest::testUp() +{ + m_path->add( m_test1 ); + + m_path->up(); + + CPPUNIT_ASSERT( !m_path->isValid() ); +} + + +void +TestPathTest::testUpThrow() +{ + m_path->up(); +} + + +void +TestPathTest::testInsert() +{ + m_path->add( m_test1 ); + + m_path->insert( m_test2, 0 ); + + CPPUNIT_ASSERT_EQUAL( 2, m_path->getTestCount() ); + CPPUNIT_ASSERT( m_test2 == m_path->getTestAt(0) ); + CPPUNIT_ASSERT( m_test1 == m_path->getTestAt(1) ); +} + + +void +TestPathTest::testInsertAtEnd() +{ + m_path->add( m_test1 ); + + m_path->insert( m_test2, 1 ); + + CPPUNIT_ASSERT_EQUAL( 2, m_path->getTestCount() ); + CPPUNIT_ASSERT( m_test1 == m_path->getTestAt(0) ); + CPPUNIT_ASSERT( m_test2 == m_path->getTestAt(1) ); +} + + +void +TestPathTest::testInsertThrow1() +{ + m_path->insert( m_test1, -1 ); +} + + +void +TestPathTest::testInsertThrow2() +{ + m_path->add( m_test1 ); + + m_path->insert( m_test1, 2 ); +} + + +void +TestPathTest::testInsertPath() +{ + CppUnit::TestPath path; + path.add( m_test2 ); + path.add( m_test3 ); + + m_path->add( m_test1 ); + m_path->add( m_test4 ); + m_path->insert( path, 1 ); + + CPPUNIT_ASSERT_EQUAL( 4, m_path->getTestCount() ); + CPPUNIT_ASSERT( m_test1 == m_path->getTestAt(0) ); + CPPUNIT_ASSERT( m_test2 == m_path->getTestAt(1) ); + CPPUNIT_ASSERT( m_test3 == m_path->getTestAt(2) ); + CPPUNIT_ASSERT( m_test4 == m_path->getTestAt(3) ); +} + + +void +TestPathTest::testInsertPathThrow() +{ + CppUnit::TestPath path; + path.add( m_test2 ); + + m_path->insert( path, 1 ); +} + + +void +TestPathTest::testInsertPathDontThrowIfInvalid() +{ + CppUnit::TestPath path; + m_path->insert( path, 1 ); +} + + +void +TestPathTest::testRootConstructor() +{ + CppUnit::TestPath path( m_test1 ); + CPPUNIT_ASSERT( path.isValid() ); + CPPUNIT_ASSERT_EQUAL( 1, path.getTestCount() ); + CPPUNIT_ASSERT( m_test1 == path.getTestAt(0) ); +} + + +void +TestPathTest::testPathSliceConstructorCopyUntilEnd() +{ + m_path->add( m_test1 ); + m_path->add( m_test2 ); + m_path->add( m_test3 ); + + CppUnit::TestPath path( *m_path, 1 ); + + CPPUNIT_ASSERT_EQUAL( 2, path.getTestCount() ); + CPPUNIT_ASSERT( m_test2 == path.getTestAt(0) ); + CPPUNIT_ASSERT( m_test3 == path.getTestAt(1) ); +} + + +void +TestPathTest::testPathSliceConstructorCopySpecifiedCount() +{ + m_path->add( m_test1 ); + m_path->add( m_test2 ); + m_path->add( m_test3 ); + + CppUnit::TestPath path( *m_path, 0, 1 ); + + CPPUNIT_ASSERT_EQUAL( 1, path.getTestCount() ); + CPPUNIT_ASSERT( m_test1 == path.getTestAt(0) ); +} + + +void +TestPathTest::testPathSliceConstructorCopyNone() +{ + m_path->add( m_test1 ); + + CppUnit::TestPath path( *m_path, 0, 0 ); + CPPUNIT_ASSERT_EQUAL( 0, path.getTestCount() ); +} + + +void +TestPathTest::testPathSliceConstructorNegativeIndex() +{ + m_path->add( m_test1 ); + m_path->add( m_test2 ); + + CppUnit::TestPath path( *m_path, -1, 2 ); + + CPPUNIT_ASSERT_EQUAL( 1, path.getTestCount() ); + CPPUNIT_ASSERT( m_test1 == path.getTestAt(0) ); +} + + +void +TestPathTest::testPathSliceConstructorAfterEndIndex() +{ + m_path->add( m_test1 ); + m_path->add( m_test2 ); + + CppUnit::TestPath path( *m_path, 2, 5 ); + + CPPUNIT_ASSERT_EQUAL( 0, path.getTestCount() ); +} + + +void +TestPathTest::testPathSliceConstructorNegativeIndexUntilEnd() +{ + m_path->add( m_test1 ); + m_path->add( m_test2 ); + + CppUnit::TestPath path( *m_path, -1 ); + + CPPUNIT_ASSERT_EQUAL( 2, path.getTestCount() ); + CPPUNIT_ASSERT( m_test1 == path.getTestAt(0) ); + CPPUNIT_ASSERT( m_test2 == path.getTestAt(1) ); +} + + +void +TestPathTest::testPathSliceConstructorNegativeIndexNone() +{ + m_path->add( m_test1 ); + m_path->add( m_test2 ); + + CppUnit::TestPath path( *m_path, -2, 1 ); + + CPPUNIT_ASSERT_EQUAL( 0, path.getTestCount() ); +} + + +void +TestPathTest::testToStringNoTest() +{ + std::string expected = "/"; + std::string actual = m_path->toString(); + + CPPUNIT_ASSERT_EQUAL( expected, actual ); +} + + +void +TestPathTest::testToStringOneTest() +{ + m_path->add( m_test1 ); + + std::string expected = "/test1"; + std::string actual = m_path->toString(); + + CPPUNIT_ASSERT_EQUAL( expected, actual ); +} + + +void +TestPathTest::testToStringHierarchy() +{ + m_path->add( m_suite1 ); + m_path->add( m_suite2 ); + m_path->add( m_suite2->getChildTestAt(0) ); + + std::string expected = "/All Tests/Custom/MyTest::testDefaultConstructor"; + std::string actual = m_path->toString(); + + CPPUNIT_ASSERT_EQUAL( expected, actual ); +} + + +void +TestPathTest::testPathStringConstructorRoot() +{ + CppUnit::TestPath path( m_suite1, "/All Tests" ); + + CPPUNIT_ASSERT_EQUAL( 1, path.getTestCount() ); + CPPUNIT_ASSERT( m_suite1 == path.getTestAt(0) ); +} + + +void +TestPathTest::testPathStringConstructorEmptyIsRoot() +{ + CppUnit::TestPath path( m_suite1, "" ); + + CPPUNIT_ASSERT_EQUAL( 1, path.getTestCount() ); + CPPUNIT_ASSERT( m_suite1 == path.getTestAt(0) ); +} + + +void +TestPathTest::testPathStringConstructorHierarchy() +{ + CppUnit::TestPath path( m_suite1, "/All Tests/Custom/MyTest::testDefaultConstructor" ); + + CPPUNIT_ASSERT_EQUAL( 3, path.getTestCount() ); + CPPUNIT_ASSERT( m_suite1 == path.getTestAt(0) ); + CPPUNIT_ASSERT( m_suite2 == path.getTestAt(1) ); + CPPUNIT_ASSERT( m_testSuite2a == path.getTestAt(2) ); +} + + +void +TestPathTest::testPathStringConstructorBadRootThrow() +{ + CppUnit::TestPath path( m_suite1, "/Custom" ); +} + + +void +TestPathTest::testPathStringConstructorRelativeRoot() +{ + CppUnit::TestPath path( m_suite1, "All Tests" ); + + CPPUNIT_ASSERT_EQUAL( 1, path.getTestCount() ); + CPPUNIT_ASSERT( m_suite1 == path.getTestAt(0) ); +} + + +void +TestPathTest::testPathStringConstructorRelativeRoot2() +{ + CppUnit::TestPath path( m_suite1, "Custom" ); + + CPPUNIT_ASSERT_EQUAL( 1, path.getTestCount() ); + CPPUNIT_ASSERT( m_suite2 == path.getTestAt(0) ); +} + + +void +TestPathTest::testPathStringConstructorThrow1() +{ + CppUnit::TestPath path( m_suite1, "/" ); +} + + +void +TestPathTest::testPathStringConstructorRelativeHierarchy() +{ + CppUnit::TestPath path( m_suite1, "Custom/MyTest::testConstructor" ); + + CPPUNIT_ASSERT_EQUAL( 2, path.getTestCount() ); + CPPUNIT_ASSERT( m_suite2 == path.getTestAt(0) ); + CPPUNIT_ASSERT( m_testSuite2b == path.getTestAt(1) ); +} + + +void +TestPathTest::testPathStringConstructorBadRelativeHierarchyThrow() +{ + CppUnit::TestPath path( m_suite1, "Custom/MyBadTest::testConstructor" ); +} diff --git a/examples/cppunittest/TestPathTest.h b/examples/cppunittest/TestPathTest.h new file mode 100644 index 0000000..6ed4a98 --- /dev/null +++ b/examples/cppunittest/TestPathTest.h @@ -0,0 +1,142 @@ +#ifndef TESTPATHTEST_H +#define TESTPATHTEST_H + +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/TestPath.h> +#include <cppunit/TestCase.h> +#include <stdexcept> + + +/*! \class TestPathTest + * \brief Unit tests for class TestPath. + */ +class TestPathTest : public CppUnit::TestFixture +{ + CPPUNIT_TEST_SUITE( TestPathTest ); + CPPUNIT_TEST( testDefaultConstructor ); + CPPUNIT_TEST( testAddTest ); + CPPUNIT_TEST_EXCEPTION( testGetTestAtThrow1, std::out_of_range ); + CPPUNIT_TEST_EXCEPTION( testGetTestAtThrow2, std::out_of_range ); + CPPUNIT_TEST( testGetChildTest ); + CPPUNIT_TEST( testGetChildTestManyTests ); + CPPUNIT_TEST_EXCEPTION( testGetChildTestThrowIfNotValid, std::out_of_range ); + CPPUNIT_TEST( testAddPath ); + CPPUNIT_TEST( testAddInvalidPath ); + CPPUNIT_TEST( testRemoveTests ); + CPPUNIT_TEST( testRemoveTest ); + CPPUNIT_TEST_EXCEPTION( testRemoveTestThrow1, std::out_of_range ); + CPPUNIT_TEST_EXCEPTION( testRemoveTestThrow2, std::out_of_range ); + CPPUNIT_TEST( testUp ); + CPPUNIT_TEST_EXCEPTION( testUpThrow, std::out_of_range ); + CPPUNIT_TEST( testInsert ); + CPPUNIT_TEST( testInsertAtEnd ); + CPPUNIT_TEST_EXCEPTION( testInsertThrow1, std::out_of_range ); + CPPUNIT_TEST_EXCEPTION( testInsertThrow2, std::out_of_range ); + CPPUNIT_TEST( testInsertPath ); + CPPUNIT_TEST_EXCEPTION( testInsertPathThrow, std::out_of_range ); + CPPUNIT_TEST( testInsertPathDontThrowIfInvalid ); + CPPUNIT_TEST( testRootConstructor ); + CPPUNIT_TEST( testPathSliceConstructorCopyUntilEnd ); + CPPUNIT_TEST( testPathSliceConstructorCopySpecifiedCount ); + CPPUNIT_TEST( testPathSliceConstructorCopyNone ); + CPPUNIT_TEST( testPathSliceConstructorNegativeIndex ); + CPPUNIT_TEST( testPathSliceConstructorAfterEndIndex ); + CPPUNIT_TEST( testPathSliceConstructorNegativeIndexUntilEnd ); + CPPUNIT_TEST( testPathSliceConstructorNegativeIndexNone ); + CPPUNIT_TEST( testToStringNoTest ); + CPPUNIT_TEST( testToStringOneTest ); + CPPUNIT_TEST( testToStringHierarchy ); + CPPUNIT_TEST( testPathStringConstructorRoot ); + CPPUNIT_TEST( testPathStringConstructorEmptyIsRoot ); + CPPUNIT_TEST( testPathStringConstructorHierarchy ); + CPPUNIT_TEST_EXCEPTION( testPathStringConstructorBadRootThrow, std::invalid_argument ); + CPPUNIT_TEST( testPathStringConstructorRelativeRoot ); + CPPUNIT_TEST( testPathStringConstructorRelativeRoot2 ); + CPPUNIT_TEST_EXCEPTION( testPathStringConstructorThrow1, std::invalid_argument ); + CPPUNIT_TEST( testPathStringConstructorRelativeHierarchy ); + CPPUNIT_TEST_EXCEPTION( testPathStringConstructorBadRelativeHierarchyThrow, std::invalid_argument ); + CPPUNIT_TEST_SUITE_END(); + +public: + /*! Constructs a TestPathTest object. + */ + TestPathTest(); + + /// Destructor. + virtual ~TestPathTest(); + + void setUp(); + void tearDown(); + + void testDefaultConstructor(); + void testAddTest(); + void testGetTestAtThrow1(); + void testGetTestAtThrow2(); + void testGetChildTest(); + void testGetChildTestManyTests(); + void testGetChildTestThrowIfNotValid(); + + void testAddPath(); + void testAddInvalidPath(); + + void testRemoveTests(); + void testRemoveTest(); + void testRemoveTestThrow1(); + void testRemoveTestThrow2(); + void testUp(); + void testUpThrow(); + + void testInsert(); + void testInsertAtEnd(); + void testInsertThrow1(); + void testInsertThrow2(); + + void testInsertPath(); + void testInsertPathThrow(); + void testInsertPathDontThrowIfInvalid(); + + void testRootConstructor(); + void testPathSliceConstructorCopyUntilEnd(); + void testPathSliceConstructorCopySpecifiedCount(); + void testPathSliceConstructorCopyNone(); + void testPathSliceConstructorNegativeIndex(); + void testPathSliceConstructorAfterEndIndex(); + void testPathSliceConstructorNegativeIndexUntilEnd(); + void testPathSliceConstructorNegativeIndexNone(); + + void testToStringNoTest(); + void testToStringOneTest(); + void testToStringHierarchy(); + + void testPathStringConstructorRoot(); + void testPathStringConstructorEmptyIsRoot(); + void testPathStringConstructorHierarchy(); + void testPathStringConstructorBadRootThrow(); + void testPathStringConstructorRelativeRoot(); + void testPathStringConstructorRelativeRoot2(); + void testPathStringConstructorThrow1(); + void testPathStringConstructorRelativeHierarchy(); + void testPathStringConstructorBadRelativeHierarchyThrow(); + +private: + /// Prevents the use of the copy constructor. + TestPathTest( const TestPathTest © ); + + /// Prevents the use of the copy operator. + 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; +}; + + + +#endif // TESTPATHTEST_H diff --git a/examples/cppunittest/TestSuiteTest.cpp b/examples/cppunittest/TestSuiteTest.cpp index d22e39a..d63dc45 100644 --- a/examples/cppunittest/TestSuiteTest.cpp +++ b/examples/cppunittest/TestSuiteTest.cpp @@ -140,3 +140,40 @@ TestSuiteTest::testDeleteContents() m_suite->deleteContents(); CPPUNIT_ASSERT_EQUAL( 0, int(m_suite->getTests().size()) ); } + + +void +TestSuiteTest::testGetChildTestCount() +{ + m_suite->addTest( new CppUnit::TestCase( "test1" ) ); + m_suite->addTest( new CppUnit::TestCase( "test2" ) ); + + CPPUNIT_ASSERT_EQUAL( 2, m_suite->getChildTestCount() ); +} + + +void +TestSuiteTest::testGetChildTestAt() +{ + CppUnit::TestCase *test1 = new CppUnit::TestCase( "test1" ); + CppUnit::TestCase *test2 = new CppUnit::TestCase( "test2" ); + m_suite->addTest( test1 ); + m_suite->addTest( test2 ); + + CPPUNIT_ASSERT( test1 == m_suite->getChildTestAt(0) ); + CPPUNIT_ASSERT( test2 == m_suite->getChildTestAt(1) ); +} + + +void +TestSuiteTest::testGetChildTestAtThrow1() +{ + m_suite->getChildTestAt(-1); +} + + +void +TestSuiteTest::testGetChildTestAtThrow2() +{ + m_suite->getChildTestAt(0); +} diff --git a/examples/cppunittest/TestSuiteTest.h b/examples/cppunittest/TestSuiteTest.h index e2a0f1f..3f9d21f 100644 --- a/examples/cppunittest/TestSuiteTest.h +++ b/examples/cppunittest/TestSuiteTest.h @@ -2,6 +2,7 @@ #define TESTSUITETEST_H #include <cppunit/extensions/HelperMacros.h> +#include <stdexcept> class TestSuiteTest : public CppUnit::TestFixture @@ -15,6 +16,10 @@ class TestSuiteTest : public CppUnit::TestFixture CPPUNIT_TEST( testRunWithOneTestAndSubSuite ); CPPUNIT_TEST( testGetTests ); CPPUNIT_TEST( testDeleteContents ); + CPPUNIT_TEST( testGetChildTestCount ); + CPPUNIT_TEST( testGetChildTestAt ); + CPPUNIT_TEST_EXCEPTION( testGetChildTestAtThrow1, std::out_of_range ); + CPPUNIT_TEST_EXCEPTION( testGetChildTestAtThrow2, std::out_of_range ); CPPUNIT_TEST_SUITE_END(); public: @@ -37,6 +42,11 @@ public: void testDeleteContents(); + void testGetChildTestCount(); + void testGetChildTestAt(); + void testGetChildTestAtThrow1(); + void testGetChildTestAtThrow2(); + private: TestSuiteTest( const TestSuiteTest © ); void operator =( const TestSuiteTest © ); diff --git a/examples/cppunittest/TestTest.cpp b/examples/cppunittest/TestTest.cpp new file mode 100644 index 0000000..c551a95 --- /dev/null +++ b/examples/cppunittest/TestTest.cpp @@ -0,0 +1,133 @@ +#include "CoreSuite.h" +#include "TestTest.h" + + +CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( TestTest, + CppUnitTest::coreSuiteName() ); + + +TestTest::TestTest() : + CppUnit::TestFixture() +{ +} + + +TestTest::~TestTest() +{ +} + + +void +TestTest::setUp() +{ + m_suite = new CppUnit::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(); +} + + +void +TestTest::tearDown() +{ + delete m_suite; + delete m_path; +} + + +void +TestTest::testFindTestPathPointerThis() +{ + CPPUNIT_ASSERT( m_test1->findTestPath( m_test1, *m_path ) ); + CPPUNIT_ASSERT_EQUAL( 1, m_path->getTestCount() ); + CPPUNIT_ASSERT( m_test1 == m_path->getChildTest() ); + + m_path->removeTests(); + + CPPUNIT_ASSERT( m_suite->findTestPath( m_suite, *m_path ) ); + CPPUNIT_ASSERT_EQUAL( 1, m_path->getTestCount() ); + CPPUNIT_ASSERT( m_suite == m_path->getChildTest() ); +} + + +void +TestTest::testFindTestPathPointer() +{ + CPPUNIT_ASSERT( m_suite->findTestPath( m_test1, *m_path ) ); + CPPUNIT_ASSERT_EQUAL( 2, m_path->getTestCount() ); + CPPUNIT_ASSERT( m_suite == m_path->getTestAt(0) ); + CPPUNIT_ASSERT( m_test1 == m_path->getTestAt(1) ); +} + + +void +TestTest::testFindTestPathPointerFail() +{ + MockTestCase test( "test" ); + CPPUNIT_ASSERT( !m_suite->findTestPath( &test, *m_path ) ); + CPPUNIT_ASSERT( !m_path->isValid() ); +} + + +void +TestTest::testFindTestPathNameThis() +{ + CPPUNIT_ASSERT( m_test1->findTestPath( "test1", *m_path ) ); + CPPUNIT_ASSERT_EQUAL( 1, m_path->getTestCount() ); + CPPUNIT_ASSERT( m_test1 == m_path->getChildTest() ); + + m_path->removeTests(); + + CPPUNIT_ASSERT( m_suite->findTestPath( "suite", *m_path ) ); + CPPUNIT_ASSERT_EQUAL( 1, m_path->getTestCount() ); + CPPUNIT_ASSERT( m_suite == m_path->getChildTest() ); +} + + +void +TestTest::testFindTestPathName() +{ + CPPUNIT_ASSERT( m_suite->findTestPath( "test2", *m_path ) ); + CPPUNIT_ASSERT_EQUAL( 2, m_path->getTestCount() ); + CPPUNIT_ASSERT( m_suite == m_path->getTestAt(0) ); + CPPUNIT_ASSERT( m_test2 == m_path->getTestAt(1) ); +} + + +void +TestTest::testFindTestPathNameFail() +{ + CPPUNIT_ASSERT( !m_suite->findTestPath( "bad-test", *m_path ) ); + CPPUNIT_ASSERT( !m_path->isValid() ); +} + + +void +TestTest::testFindTest() +{ + CPPUNIT_ASSERT( m_test1 == m_suite->findTest( "test1" ) ); +} + + +void +TestTest::testFindTestThrow() +{ + m_suite->findTest( "no-name" ); +} + + +void +TestTest::testResolveTestPath() +{ + CppUnit::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_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 new file mode 100644 index 0000000..fa0cef2 --- /dev/null +++ b/examples/cppunittest/TestTest.h @@ -0,0 +1,67 @@ +#ifndef TESTTEST_H +#define TESTTEST_H + +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/TestSuite.h> +#include <cppunit/TestPath.h> +#include "MockTestCase.h" +#include <stdexcept> + + +/*! \class TestTest + * \brief Unit test for class Test. + */ +class TestTest : public CppUnit::TestFixture +{ + CPPUNIT_TEST_SUITE( TestTest ); + CPPUNIT_TEST( testFindTestPathPointerThis ); + CPPUNIT_TEST( testFindTestPathPointer ); + CPPUNIT_TEST( testFindTestPathPointerFail ); + CPPUNIT_TEST( testFindTestPathNameThis ); + CPPUNIT_TEST( testFindTestPathName ); + CPPUNIT_TEST( testFindTestPathNameFail ); + CPPUNIT_TEST( testFindTest ); + CPPUNIT_TEST_EXCEPTION( testFindTestThrow, std::invalid_argument ); + CPPUNIT_TEST( testResolveTestPath ); + CPPUNIT_TEST_SUITE_END(); + +public: + /*! Constructs a TestTest object. + */ + TestTest(); + + /// Destructor. + virtual ~TestTest(); + + void setUp(); + void tearDown(); + + void testFindTestPathPointerThis(); + void testFindTestPathPointer(); + void testFindTestPathPointerFail(); + + void testFindTestPathNameThis(); + void testFindTestPathName(); + void testFindTestPathNameFail(); + + void testFindTest(); + void testFindTestThrow(); + + void testResolveTestPath(); + +private: + /// Prevents the use of the copy constructor. + TestTest( const TestTest © ); + + /// Prevents the use of the copy operator. + void operator =( const TestTest © ); + +private: + CppUnit::TestSuite *m_suite; + MockTestCase *m_test1; + MockTestCase *m_test2; + CppUnit::TestPath *m_path; +}; + + +#endif // TESTTEST_H diff --git a/examples/cppunittest/TrackedTestCase.cpp b/examples/cppunittest/TrackedTestCase.cpp index 37d3c42..aaa3d98 100644 --- a/examples/cppunittest/TrackedTestCase.cpp +++ b/examples/cppunittest/TrackedTestCase.cpp @@ -3,6 +3,7 @@ Tracker *TrackedTestCase::ms_tracker = NULL; TrackedTestCase::TrackedTestCase() +: TestCase( "" ) { if ( ms_tracker != NULL ) ms_tracker->onConstructor(); diff --git a/examples/cppunittest/XmlOutputterTest.cpp b/examples/cppunittest/XmlOutputterTest.cpp index 8755db1..7ee766e 100644 --- a/examples/cppunittest/XmlOutputterTest.cpp +++ b/examples/cppunittest/XmlOutputterTest.cpp @@ -73,6 +73,17 @@ XmlOutputterTest::testEscapedAttributeValueToString() void +XmlOutputterTest::testNodeToStringEscapeContent() +{ + CppUnit::XmlOutputter::Node node( "element", "ChessTest<class Chess>" ); + std::string expectedXml = "<element>" + "ChessTest<class Chess>" + "</element>"; + CPPUNITTEST_ASSERT_XML_EQUAL( expectedXml, node.toString() ); +} + + +void XmlOutputterTest::testNodeWithChildrenToString() { CppUnit::XmlOutputter::Node node( "element" ); @@ -155,7 +166,7 @@ XmlOutputterTest::testWriteXmlResultWithOneFailure() "<File>test.cpp</File>" "<Line>3</Line>" "</Location>" - "message failure1" + "<Message>message failure1</Message>" "</FailedTest>" "</FailedTests>" "<SucessfulTests></SucessfulTests>" @@ -186,7 +197,7 @@ XmlOutputterTest::testWriteXmlResultWithOneError() "<FailedTest id=\"1\">" "<Name>test1</Name>" "<FailureType>Error</FailureType>" - "message error1" + "<Message>message error1</Message>" "</FailedTest>" "</FailedTests>" "<SucessfulTests></SucessfulTests>" @@ -252,27 +263,27 @@ XmlOutputterTest::testWriteXmlResultWithThreeFailureTwoErrorsAndTwoSucess() "<FailedTest id=\"1\">" "<Name>test1</Name>" "<FailureType>Assertion</FailureType>" - "failure1" + "<Message>failure1</Message>" "</FailedTest>" "<FailedTest id=\"2\">" "<Name>test2</Name>" "<FailureType>Error</FailureType>" - "error1" + "<Message>error1</Message>" "</FailedTest>" "<FailedTest id=\"3\">" "<Name>test3</Name>" "<FailureType>Assertion</FailureType>" - "failure2" + "<Message>failure2</Message>" "</FailedTest>" "<FailedTest id=\"4\">" "<Name>test4</Name>" "<FailureType>Assertion</FailureType>" - "failure3" + "<Message>failure3</Message>" "</FailedTest>" "<FailedTest id=\"6\">" "<Name>test6</Name>" "<FailureType>Error</FailureType>" - "error2" + "<Message>error2</Message>" "</FailedTest>" "</FailedTests>" "<SucessfulTests>" diff --git a/examples/cppunittest/XmlOutputterTest.h b/examples/cppunittest/XmlOutputterTest.h index 9f1ef65..7303464 100644 --- a/examples/cppunittest/XmlOutputterTest.h +++ b/examples/cppunittest/XmlOutputterTest.h @@ -17,6 +17,7 @@ class XmlOutputterTest : public CppUnit::TestFixture CPPUNIT_TEST( testEmptyNodeToString ); CPPUNIT_TEST( testNodeWithAttributesToString ); CPPUNIT_TEST( testEscapedAttributeValueToString ); + CPPUNIT_TEST( testNodeToStringEscapeContent ); CPPUNIT_TEST( testNodeWithChildrenToString ); CPPUNIT_TEST( testNodeWithContentToString ); CPPUNIT_TEST( testNodeWithNumericContentToString ); @@ -42,6 +43,7 @@ public: void testEmptyNodeToString(); void testNodeWithAttributesToString(); void testEscapedAttributeValueToString(); + void testNodeToStringEscapeContent(); void testNodeWithChildrenToString(); void testNodeWithContentToString(); void testNodeWithNumericContentToString(); |
