[Cppunit-cvs] cppunit2/src/cpputtest assertstringtest.cpp,1.2,1.3 testbasicassertion.cpp,1.4,1.5 tes
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2004-11-20 15:07:11
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18083/src/cpputtest Modified Files: assertstringtest.cpp testbasicassertion.cpp testfunctor.cpp testtestcase.cpp testtestsuite.cpp Log Message: * TestContext: no longer rely on exception to retrieve failure * TestContext: removed TestListener support since everything is handled by TestInfo * TestFailureGuard: modified to report fault using TestInfo instead of exception * TestListener, TestResult, TestRunResult: removed, replaced by TestInfo * TextTestDriver: fixed bug in result merging (not prefixed with "/result"). Still need work to handle assertion and fault reporting. Index: assertstringtest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/assertstringtest.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** assertstringtest.cpp 4 Aug 2004 08:01:15 -0000 1.2 --- assertstringtest.cpp 20 Nov 2004 15:07:00 -0000 1.3 *************** *** 1,5 **** #include "assertstringtest.h" #include <cpput/assertstring.h> - #include <cpput/resultexception.h> #include <string.h> // use string.h for easier portability --- 1,4 ---- Index: testbasicassertion.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testbasicassertion.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** testbasicassertion.cpp 20 Nov 2004 12:17:52 -0000 1.4 --- testbasicassertion.cpp 20 Nov 2004 15:07:00 -0000 1.5 *************** *** 1,4 **** #include <cpput/assert.h> - #include <cpput/resultexception.h> #include <iostream> --- 1,3 ---- Index: testtestsuite.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testtestsuite.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** testtestsuite.cpp 20 Nov 2004 12:17:52 -0000 1.4 --- testtestsuite.cpp 20 Nov 2004 15:07:00 -0000 1.5 *************** *** 1,4 **** #include <cpput/assert.h> - #include <cpput/resultexception.h> #include <cpput/testcase.h> #include <cpput/testsuite.h> --- 1,3 ---- Index: testtestcase.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testtestcase.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** testtestcase.cpp 20 Nov 2004 12:17:52 -0000 1.7 --- testtestcase.cpp 20 Nov 2004 15:07:00 -0000 1.8 *************** *** 1,5 **** #include <cpput/assert.h> - #include <cpput/resultexception.h> - #include <cpput/testrunresult.h> #include <cpput/testcase.h> #include <cpput/testcontext.h> --- 1,3 ---- *************** *** 77,80 **** --- 75,89 ---- + static bool runTestCase( CppUT::Test &test ) + { + bool success = false; + { + CppUT::TestInfo::ScopedContextOverride contextOverride; + CppUT::TestContext context; + success = context.run( static_cast<CppUT::AbstractTestCase &>( test ) ); + } + return success; + } + static void testCaseSimpleRun() { *************** *** 92,101 **** CPPUT_ASSERT_EQUAL( 0, visitor.visitTestSuiteCount_ ); ! CppUT::TestContext context; ! CppUT::TestRunResult result; ! context.add( result ); ! context.run( static_cast<CppUT::AbstractTestCase &>( *test ) ); CPPUT_ASSERT_EQUAL( 1, testCall ); - CPPUT_ASSERT_EQUAL( 0, result.failureCount() ); } --- 101,106 ---- CPPUT_ASSERT_EQUAL( 0, visitor.visitTestSuiteCount_ ); ! CPPUT_ASSERT( runTestCase( *test ), "testCaseSimpleRun" ); CPPUT_ASSERT_EQUAL( 1, testCall ); } *************** *** 129,140 **** CPPUT_ASSERT( test->isTestCase() ); ! CppUT::TestContext context; ! CppUT::TestRunResult result; ! context.add( result ); ! context.run( static_cast<CppUT::AbstractTestCase &>( *test ) ); CPPUT_ASSERT_EQUAL( 1, testSetUpCall ); CPPUT_ASSERT_EQUAL( 1, testRunCall ); CPPUT_ASSERT_EQUAL( 1, testTearDownCall ); - CPPUT_ASSERT_EQUAL( 0, result.failureCount() ); } --- 134,141 ---- CPPUT_ASSERT( test->isTestCase() ); ! CPPUT_ASSERT_EXPR( runTestCase( *test ) ); CPPUT_ASSERT_EQUAL( 1, testSetUpCall ); CPPUT_ASSERT_EQUAL( 1, testRunCall ); CPPUT_ASSERT_EQUAL( 1, testTearDownCall ); } *************** *** 151,162 **** CPPUT_ASSERT( test->isTestCase() ); ! CppUT::TestContext context; ! CppUT::TestRunResult result; ! context.add( result ); ! context.run( static_cast<CppUT::AbstractTestCase &>( *test ) ); CPPUT_ASSERT_EQUAL( 1, testSetUpCall ); CPPUT_ASSERT_EQUAL( 0, testRunCall ); CPPUT_ASSERT_EQUAL( 0, testTearDownCall ); - CPPUT_ASSERT_EQUAL( 1, result.failureCount() ); } --- 152,159 ---- CPPUT_ASSERT( test->isTestCase() ); ! CPPUT_ASSERT_EXPR( runTestCase( *test ) ); CPPUT_ASSERT_EQUAL( 1, testSetUpCall ); CPPUT_ASSERT_EQUAL( 0, testRunCall ); CPPUT_ASSERT_EQUAL( 0, testTearDownCall ); } *************** *** 173,184 **** CPPUT_ASSERT( test->isTestCase() ); ! CppUT::TestContext context; ! CppUT::TestRunResult result; ! context.add( result ); ! context.run( static_cast<CppUT::AbstractTestCase &>( *test ) ); CPPUT_ASSERT_EQUAL( 1, testSetUpCall ); CPPUT_ASSERT_EQUAL( 1, testRunCall ); CPPUT_ASSERT_EQUAL( 1, testTearDownCall ); - CPPUT_ASSERT_EQUAL( 1, result.failureCount() ); } --- 170,177 ---- CPPUT_ASSERT( test->isTestCase() ); ! CPPUT_ASSERT_EXPR( runTestCase( *test ) ); CPPUT_ASSERT_EQUAL( 1, testSetUpCall ); CPPUT_ASSERT_EQUAL( 1, testRunCall ); CPPUT_ASSERT_EQUAL( 1, testTearDownCall ); } *************** *** 195,206 **** CPPUT_ASSERT( test->isTestCase() ); ! CppUT::TestContext context; ! CppUT::TestRunResult result; ! context.add( result ); ! context.run( static_cast<CppUT::AbstractTestCase &>( *test ) ); CPPUT_ASSERT_EQUAL( 1, testSetUpCall ); CPPUT_ASSERT_EQUAL( 1, testRunCall ); CPPUT_ASSERT_EQUAL( 1, testTearDownCall ); - CPPUT_ASSERT_EQUAL( 1, result.failureCount() ); } --- 188,195 ---- CPPUT_ASSERT( test->isTestCase() ); ! CPPUT_ASSERT_EXPR( runTestCase( *test ) ); CPPUT_ASSERT_EQUAL( 1, testSetUpCall ); CPPUT_ASSERT_EQUAL( 1, testRunCall ); CPPUT_ASSERT_EQUAL( 1, testTearDownCall ); } *************** *** 217,228 **** CPPUT_ASSERT( test->isTestCase() ); CPPUT_ASSERT_EQUAL( "Test1", test->name() ); ! CppUT::TestContext context; ! CppUT::TestRunResult result; ! context.add( result ); ! context.run( static_cast<CppUT::AbstractTestCase &>( *test ) ); CPPUT_ASSERT_EQUAL( 1, fixture->setUp_ ); CPPUT_ASSERT_EQUAL( 1, fixture->run_ ); CPPUT_ASSERT_EQUAL( 1, fixture->tearDown_ ); - CPPUT_ASSERT_EQUAL( 0, result.failureCount() ); } --- 206,214 ---- CPPUT_ASSERT( test->isTestCase() ); CPPUT_ASSERT_EQUAL( "Test1", test->name() ); ! ! CPPUT_ASSERT_EXPR( runTestCase( *test ) ); CPPUT_ASSERT_EQUAL( 1, fixture->setUp_ ); CPPUT_ASSERT_EQUAL( 1, fixture->run_ ); CPPUT_ASSERT_EQUAL( 1, fixture->tearDown_ ); } *************** *** 238,249 **** CPPUT_ASSERT( test->isTestCase() ); CPPUT_ASSERT_EQUAL( "Test1", test->name() ); ! CppUT::TestContext context; ! CppUT::TestRunResult result; ! context.add( result ); ! context.run( static_cast<CppUT::AbstractTestCase &>( *test ) ); CPPUT_ASSERT_EQUAL( 0, fixture->setUp_ ); CPPUT_ASSERT_EQUAL( 111, fixture->run_ ); CPPUT_ASSERT_EQUAL( 0, fixture->tearDown_ ); - CPPUT_ASSERT_EQUAL( 0, result.failureCount() ); } --- 224,232 ---- CPPUT_ASSERT( test->isTestCase() ); CPPUT_ASSERT_EQUAL( "Test1", test->name() ); ! ! CPPUT_ASSERT_EXPR( runTestCase( *test ) ); CPPUT_ASSERT_EQUAL( 0, fixture->setUp_ ); CPPUT_ASSERT_EQUAL( 111, fixture->run_ ); CPPUT_ASSERT_EQUAL( 0, fixture->tearDown_ ); } Index: testfunctor.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testfunctor.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** testfunctor.cpp 20 Nov 2004 12:17:52 -0000 1.5 --- testfunctor.cpp 20 Nov 2004 15:07:00 -0000 1.6 *************** *** 1,4 **** #include <cpput/assert.h> - #include <cpput/resultexception.h> #include <cpput/functor.h> #include <iostream> --- 1,3 ---- |