cppunit-cvs Mailing List for CppUnit - C++ port of JUnit (Page 13)
Brought to you by:
blep
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(94) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
|
Feb
(114) |
Mar
(80) |
Apr
|
May
|
Jun
(36) |
Jul
(67) |
Aug
(37) |
Sep
(33) |
Oct
(28) |
Nov
(91) |
Dec
(16) |
2006 |
Jan
(1) |
Feb
(7) |
Mar
(45) |
Apr
|
May
|
Jun
(36) |
Jul
(7) |
Aug
|
Sep
(32) |
Oct
(3) |
Nov
|
Dec
|
2007 |
Jan
(29) |
Feb
(11) |
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(35) |
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
(14) |
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
(13) |
Aug
|
Sep
|
Oct
(3) |
Nov
|
Dec
(15) |
From: Baptiste L. <bl...@us...> - 2005-11-11 23:24:00
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11942/src/cpput Removed Files: properties.cpp Log Message: Rough documentation: placed most function/class/macro in group. --- properties.cpp DELETED --- |
From: Baptiste L. <bl...@us...> - 2005-11-11 20:54:25
|
Update of /cvsroot/cppunit/cppunit2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6524 Modified Files: sconstruct Log Message: - added unit tests for TestInfo - fixed bug in CPPUT_IGNORE_FAILURE and exception guard. - added 'isIgnoredFailure' to Assertion. - lighttestrunner now print ignored failure and skipped tests. Index: sconstruct =================================================================== RCS file: /cvsroot/cppunit/cppunit2/sconstruct,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** sconstruct 10 Nov 2005 09:15:12 -0000 1.21 --- sconstruct 11 Nov 2005 20:54:14 -0000 1.22 *************** *** 131,134 **** --- 131,135 ---- buildProjectInDirectory( 'examples/parametrized_test' ) buildProjectInDirectory( 'examples/checking_assertions' ) + buildProjectInDirectory( 'examples/ignore_failure_demo' ) buildProjectInDirectory( 'examples/log_demo' ) buildProjectInDirectory( 'examples/stringize_demo' ) |
From: Baptiste L. <bl...@us...> - 2005-11-11 20:54:24
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6524/include/cpput Modified Files: assert.h exceptionguard.h lighttestrunner.h testinfo.h Log Message: - added unit tests for TestInfo - fixed bug in CPPUT_IGNORE_FAILURE and exception guard. - added 'isIgnoredFailure' to Assertion. - lighttestrunner now print ignored failure and skipped tests. Index: testinfo.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testinfo.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** testinfo.h 9 Nov 2005 20:04:06 -0000 1.17 --- testinfo.h 11 Nov 2005 20:54:15 -0000 1.18 *************** *** 77,80 **** --- 77,83 ---- Kind kind() const; + void setIgnoredFailure(); + bool isIgnoredFailure() const; + void setMessages( const Message &messages ); const Message &messages() const; *************** *** 97,100 **** --- 100,104 ---- SourceLocation location_; Kind kind_; + bool isIgnoredFailure_; }; *************** *** 127,134 **** --- 131,149 ---- void addSpecific( const std::string &type, const Json::Value &value ); + + int assertionCount() const; + int failedAssertionCount() const; + int ignoredFailureCount() const; + + void increaseAssertionCount( int delta = 1 ); + void increaseFailedAssertionCount( int delta = 1 ); + void increaseIgnoredFailureCount( int delta = 1 ); private: Json::Value statistics_; Json::Value specifics_; Status status_; + unsigned int assertionCount_; + unsigned int failedAssertionCount_; + unsigned int ignoredFailureCount_; }; *************** *** 169,176 **** ~ScopedContextOverride(); ! private: TestInfoPtr context_; }; static TestInfo &threadInstance(); --- 184,211 ---- ~ScopedContextOverride(); ! protected: TestInfoPtr context_; }; + class CPPUT_API IgnoreFailureScopedContextOverride : public ScopedContextOverride + , private TestResultUpdater + { + public: + IgnoreFailureScopedContextOverride( bool &assertionFailed ); + + ~IgnoreFailureScopedContextOverride(); + + private: // overridden from TestResultUpdater + virtual void addResultLog( const Json::Value &log ); + + virtual void addResultAssertion( const Assertion &assertion ); + + private: + Assertion *assertion_; + bool &assertionFailed_; + }; + + friend class IgnoreFailureScopedContextOverride; + static TestInfo &threadInstance(); *************** *** 179,186 **** void setTestResultUpdater( TestResultUpdater &updater ); void startNewTest(); ! TestStatus &getUpdatedTestStatus(); void newAssertion( AssertionType type, --- 214,222 ---- void setTestResultUpdater( TestResultUpdater &updater ); + void removeTestResultUpdater(); void startNewTest(); ! TestStatus &testStatus(); void newAssertion( AssertionType type, *************** *** 197,202 **** void setAbortingAssertionMode( AbortingAssertionMode mode ); - void ignoredFailure(); - void log( const Json::Value &log ); --- 233,236 ---- *************** *** 207,221 **** AssertionType assertionType_; AbortingAssertionMode abortingAssertionMode_; - unsigned int assertionCount_; - unsigned int failedAssertionCount_; - unsigned int ignoredAssertionCount_; }; - //void CPPUT_API newAssertion( AssertionType type, - // const char *fileName, - // unsigned int lineNumber, - // const char *functionName = 0 ); - Assertion &CPPUT_API currentAssertion(); --- 241,247 ---- *************** *** 230,233 **** --- 256,261 ---- void CPPUT_API log( const std::string &log ); + void CPPUT_API log( const char *log ); + // This overload allows usage of StringConcatenator... void CPPUT_API log( const CppTL::ConstString &log ); Index: assert.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/assert.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** assert.h 9 Nov 2005 20:04:06 -0000 1.15 --- assert.h 11 Nov 2005 20:54:15 -0000 1.16 *************** *** 253,259 **** } catch ( const ::CppUT::AbortingAssertionException & ) { \ } \ ! assertionFailedCppUT_ = ::CppUT::TestInfo::threadInstance().getUpdatedTestStatus().hasFailed(); \ } \ ! ::CppUT::checkAssertionFail( assertionFailedCppUT_, message ); \ } --- 253,259 ---- } catch ( const ::CppUT::AbortingAssertionException & ) { \ } \ ! assertionFailedCppUT_ = ::CppUT::TestInfo::threadInstance().testStatus().hasFailed(); \ } \ ! ::CppUT::checkAssertionFail( assertionFailedCppUT_, message ); \ } *************** *** 280,284 **** } catch ( const ::CppUT::AbortingAssertionException & ) { \ } \ ! assertionFailedCppUT_ = ::CppUT::TestInfo::threadInstance().getUpdatedTestStatus().hasFailed(); \ } \ ::CppUT::checkAssertionPass( assertionFailedCppUT_, message ); \ --- 280,284 ---- } catch ( const ::CppUT::AbortingAssertionException & ) { \ } \ ! assertionFailedCppUT_ = ::CppUT::TestInfo::threadInstance().testStatus().hasFailed(); \ } \ ::CppUT::checkAssertionPass( assertionFailedCppUT_, message ); \ *************** *** 300,316 **** ::CppUT::skipCurrentTest ! # define CPPUT_IGNORE_FAILURE( assertion ) \ { \ ! bool succeedCppUT_ = false; \ { \ ! ::CppUT::TestInfo::ScopedContextOverride contextSwitchCppUT_; \ try { \ assertion; \ } catch ( const ::CppUT::AbortingAssertionException & ) { \ } \ - succeedCppUT_ = ::CppUT::TestInfo::threadInstance().getUpdatedTestStatus().hasPassed(); \ } \ ! ::CppUT::checkAssertionFail( !succeedCppUT_, #assertion ); \ ! ::CppUT::TestInfo::threadInstance().ignoredFailure(); \ } --- 300,332 ---- ::CppUT::skipCurrentTest ! /*! Checks that an assertion fail, but ignore its failure ! * ! * A typical usage of CPPUT_IGNORE_FAILURE is to ignore a failing assertion temporary. ! * Even if the assertion fails, it does not cause the test to fail, but increased ! * CppUT::TestStatus::ignoredFailureCount() instead. ! * ! * Notes that CPPUT_IGNORE_FAILURE also checks that the \c assertion fails (just like ! * CPPUT_CHECK_ASSERTION_FAIL) and will therefore cause the test to fail if the ! * assertion did not fail. ! * ! * \code ! * CPPUT_IGNORE_FAILURE(( CPPUT_ASSERT_EQUAL( 1, 2 )); ! * \endcode ! * ! * \warning Be sure to always use double brace around the macro parameter to avoid ! * preprocessor mess. ! */ ! # define CPPUT_IGNORE_FAILURE( assertion ) \ { \ ! CPPUT_CHECK_POINT( checkingAssertion ); \ ! bool failedCppUT_; \ { \ ! ::CppUT::TestInfo::IgnoreFailureScopedContextOverride contextSwitchCppUT_( failedCppUT_ );\ try { \ assertion; \ } catch ( const ::CppUT::AbortingAssertionException & ) { \ } \ } \ ! ::CppUT::checkAssertionFail( failedCppUT_, #assertion ); \ } Index: exceptionguard.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/exceptionguard.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** exceptionguard.h 8 Nov 2005 21:50:33 -0000 1.3 --- exceptionguard.h 11 Nov 2005 20:54:15 -0000 1.4 *************** *** 41,44 **** --- 41,46 ---- /** Helpers to provide simple exception translation. + * \warning Ensure that either a fault, assertion is added to TestInfo, or + * that TestStatus is set to \c failed otherwise the test will not fail! */ template<class ExceptionType *************** *** 82,85 **** --- 84,88 ---- void removeLast(); + /// Returns \c true if the test did not fail (skipped or passed TestStatus). bool protect( CppTL::Functor0 test ) const; *************** *** 92,96 **** /** Register an exception translator. ! * @todo provides some helper to generate faul result... * \code * static void translateMFCException( CException *e ) { --- 95,99 ---- /** Register an exception translator. ! * @todo provides some helper to generate fault result... * \code * static void translateMFCException( CException *e ) { *************** *** 106,109 **** --- 109,114 ---- * } * \endcode + * \warning Ensure that either a fault, assertion is added to TestInfo, or + * that TestStatus is set to \c failed otherwise the test will not fail! */ template<class Translator Index: lighttestrunner.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/lighttestrunner.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** lighttestrunner.h 8 Nov 2005 20:25:49 -0000 1.5 --- lighttestrunner.h 11 Nov 2005 20:54:15 -0000 1.6 *************** *** 55,58 **** --- 55,60 ---- unsigned int testRun_; unsigned int testFailed_; + unsigned int testSkipped_; + unsigned int ignoredFailureCount_; }; |
From: Baptiste L. <bl...@us...> - 2005-11-11 20:54:24
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6524/src/cpputtest Modified Files: SConscript main.cpp testexceptionguard.cpp Log Message: - added unit tests for TestInfo - fixed bug in CPPUT_IGNORE_FAILURE and exception guard. - added 'isIgnoredFailure' to Assertion. - lighttestrunner now print ignored failure and skipped tests. Index: main.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/main.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** main.cpp 8 Nov 2005 23:25:31 -0000 1.25 --- main.cpp 11 Nov 2005 20:54:15 -0000 1.26 *************** *** 4,11 **** #include "assertenumtest.h" #include "assertstringtest.h" - #include "registrytest.h" #include "enumeratortest.h" - #include "testfixturetest.h" #include "reflectiontest.h" //#include "formattest.h" --- 4,11 ---- #include "assertenumtest.h" #include "assertstringtest.h" #include "enumeratortest.h" #include "reflectiontest.h" + #include "registrytest.h" + #include "testfixturetest.h" //#include "formattest.h" *************** *** 19,22 **** --- 19,23 ---- bool testTestCase(); bool testFunctors(); + bool testTestInfo(); *************** *** 25,28 **** --- 26,30 ---- return testBasicAssertions() && testFunctors() && + testTestInfo() && testExceptionGuard() && // testTestContext() && Index: SConscript =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/SConscript,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** SConscript 10 Nov 2005 09:05:41 -0000 1.14 --- SConscript 11 Nov 2005 20:54:15 -0000 1.15 *************** *** 11,14 **** --- 11,15 ---- testfunctor.cpp testfixturetest.cpp + testinfotest.cpp testtestcase.cpp testtestsuite.cpp Index: testexceptionguard.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testexceptionguard.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** testexceptionguard.cpp 10 Aug 2005 21:34:29 -0000 1.2 --- testexceptionguard.cpp 11 Nov 2005 20:54:15 -0000 1.3 *************** *** 7,10 **** --- 7,11 ---- { ++*value; + CppUT::TestInfo::threadInstance().testStatus().setStatus( CppUT::TestStatus::failed ); } *************** *** 43,49 **** int value = 1; CppUT::ExceptionGuard guard; bool result = guard.protect( CppTL::bind_cfn( &increment, &value ) ); CPPUT_ASSERT_EQUAL( 2, value ); ! CPPUT_ASSERT_EQUAL( true, result ); } --- 44,51 ---- int value = 1; CppUT::ExceptionGuard guard; + CppUT::TestInfo::threadInstance().startNewTest(); bool result = guard.protect( CppTL::bind_cfn( &increment, &value ) ); CPPUT_ASSERT_EQUAL( 2, value ); ! ( true, result ); } *************** *** 53,56 **** --- 55,59 ---- { CppUT::ExceptionGuard guard; + CppUT::TestInfo::threadInstance().startNewTest(); bool result = guard.protect( CppTL::cfn0( &throwStdException ) ); CPPUT_ASSERT_EQUAL( false, result ); *************** *** 62,65 **** --- 65,69 ---- { CppUT::ExceptionGuard guard; + CppUT::TestInfo::threadInstance().startNewTest(); bool result = guard.protect( CppTL::cfn0( &throwAnyException ) ); CPPUT_ASSERT_EQUAL( false, result ); *************** *** 71,74 **** --- 75,79 ---- { ++*value; + CppUT::TestInfo::threadInstance().testStatus().setStatus( CppUT::TestStatus::failed ); } *************** *** 82,85 **** --- 87,91 ---- CppTL::bind2( CppTL::cfn2( &customExceptionTranslation ), &value ), CppTL::Type<CustomException>() ); + CppUT::TestInfo::threadInstance().startNewTest(); bool result = guard.protect( CppTL::cfn0( &throwCustomException ) ); CPPUT_ASSERT_EQUAL( false, result ); *************** *** 87,94 **** --- 93,102 ---- // check that standard and ... catch handler are still active. + CppUT::TestInfo::threadInstance().startNewTest(); result = guard.protect( CppTL::cfn0( &throwStdException ) ); CPPUT_ASSERT_EQUAL( false, result ); CPPUT_ASSERT_EQUAL( 2, value ); + CppUT::TestInfo::threadInstance().startNewTest(); result = guard.protect( CppTL::cfn0( &throwAnyException ) ); CPPUT_ASSERT_EQUAL( false, result ); *************** *** 98,105 **** --- 106,115 ---- // check that standard and ... catch handler are still active, // but not the custom exception handler. + CppUT::TestInfo::threadInstance().startNewTest(); result = guard.protect( CppTL::cfn0( &throwCustomException ) ); CPPUT_ASSERT_EQUAL( false, result ); CPPUT_ASSERT_EQUAL( 2, value ); + CppUT::TestInfo::threadInstance().startNewTest(); result = guard.protect( CppTL::cfn0( &throwStdException ) ); CPPUT_ASSERT_EQUAL( false, result ); *************** *** 107,110 **** --- 117,124 ---- + /* Notes: startNewtest() must be called before each protect because + * protect() returns value depends on testStatus. + */ + bool testExceptionGuard() { *************** *** 112,115 **** --- 126,130 ---- try { + CppUT::TestInfo::threadInstance().startNewTest(); testExceptionGuardRunFunctor(); testExceptionGuardCatchStandardException(); |
From: Baptiste L. <bl...@us...> - 2005-11-11 20:54:24
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6524/src/cpput Modified Files: assert.cpp exceptionguard.cpp lighttestrunner.cpp testcase.cpp testinfo.cpp Log Message: - added unit tests for TestInfo - fixed bug in CPPUT_IGNORE_FAILURE and exception guard. - added 'isIgnoredFailure' to Assertion. - lighttestrunner now print ignored failure and skipped tests. Index: assert.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/assert.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** assert.cpp 9 Nov 2005 20:04:06 -0000 1.16 --- assert.cpp 11 Nov 2005 20:54:15 -0000 1.17 *************** *** 120,124 **** skipCurrentTest() { ! TestStatus &status = TestInfo::threadInstance().getUpdatedTestStatus(); if ( status.hasPassed() ) status.setStatus( TestStatus::skipped ); --- 120,124 ---- skipCurrentTest() { ! TestStatus &status = TestInfo::threadInstance().testStatus(); if ( status.hasPassed() ) status.setStatus( TestStatus::skipped ); Index: exceptionguard.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/exceptionguard.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** exceptionguard.cpp 9 Nov 2005 20:04:06 -0000 1.8 --- exceptionguard.cpp 11 Nov 2005 20:54:15 -0000 1.9 *************** *** 35,39 **** else context.test_(); ! return !(TestInfo::threadInstance().getUpdatedTestStatus().hasFailed()); } --- 35,39 ---- else context.test_(); ! return !(TestInfo::threadInstance().testStatus().hasFailed()); } Index: lighttestrunner.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/lighttestrunner.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** lighttestrunner.cpp 9 Nov 2005 22:42:31 -0000 1.11 --- lighttestrunner.cpp 11 Nov 2005 20:54:15 -0000 1.12 *************** *** 11,14 **** --- 11,16 ---- : testRun_( 0 ) , testFailed_( 0 ) + , testSkipped_( 0 ) + , ignoredFailureCount_( 0 ) { } *************** *** 37,51 **** fprintf( stdout, "Failure report:\n%s", report_.c_str() ); fflush( stdout ); ! fprintf( stdout, "%d/%d tests passed, %d tests failed.", testRun_ - testFailed_, testRun_, testFailed_ ); - fflush( stdout ); } else { ! fprintf( stdout, "All %d tests passed.\n", testRun_ ); fflush( stdout ); } return testFailed_ == 0; } --- 39,58 ---- fprintf( stdout, "Failure report:\n%s", report_.c_str() ); fflush( stdout ); ! fprintf( stdout, "%d/%d tests passed, %d tests failed", testRun_ - testFailed_, testRun_, testFailed_ ); } else { ! fprintf( stdout, "All %d tests passed", testRun_ ); fflush( stdout ); } + + if ( ignoredFailureCount_ > 0 ) + fprintf( stdout, ", %d ignored failures", ignoredFailureCount_ ); + fprintf( stdout, ".\n", ignoredFailureCount_ ); + fflush( stdout ); + return testFailed_ == 0; } *************** *** 81,91 **** results_.clear(); ++testRun_; ! bool succeeded = testCase->runTest(); ! fprintf( stdout, "%s\n", succeeded ? "OK" : "FAIL" ); ! fflush( stdout ); ! if ( !succeeded ) { ++testFailed_; CppTL::ConstString resultType = assertions_.back().kind() == Assertion::fault ? "fault" --- 88,122 ---- results_.clear(); ++testRun_; ! testCase->runTest(); ! ! TestStatus &testStatus = TestInfo::threadInstance().testStatus(); ! std::string status; ! switch ( testStatus.status() ) { + case TestStatus::passed: + status = "OK"; + break; + case TestStatus::skipped: + status = "SKIP"; + ++testSkipped_; + break; + case TestStatus::failed: + status = "FAIL"; ++testFailed_; + break; + default: status = "?"; break; + } + + if ( testStatus.ignoredFailureCount() > 0 ) + { + std::string count = CppTL::toString( testStatus.ignoredFailureCount() ).c_str(); + status += " (" + count + " ignored failures)"; + } + + fprintf( stdout, "%s\n", status.c_str() ); + fflush( stdout ); + if ( !assertions_.empty() ) + { CppTL::ConstString resultType = assertions_.back().kind() == Assertion::fault ? "fault" *************** *** 153,156 **** --- 184,192 ---- CppTL::ConstString failureType = failure.kind() == Assertion::fault ? "fault" : "assertion"; + if ( failure.isIgnoredFailure() ) + { + failureType = "*ignored* " + failureType; + ++ignoredFailureCount_; + } report_ += "[failure type: " + failureType + "]\n"; if ( !failure.messages().empty() ) Index: testinfo.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testinfo.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** testinfo.cpp 9 Nov 2005 20:04:06 -0000 1.19 --- testinfo.cpp 11 Nov 2005 20:54:15 -0000 1.20 *************** *** 15,18 **** --- 15,19 ---- : kind_( kind ) , location_( sourceLocation ) + , isIgnoredFailure_( false ) { } *************** *** 48,51 **** --- 49,65 ---- void + Assertion::setIgnoredFailure() + { + isIgnoredFailure_ = true; + } + + bool + Assertion::isIgnoredFailure() const + { + return isIgnoredFailure_; + } + + + void Assertion::setMessages( const Message &messages ) { *************** *** 127,130 **** --- 141,147 ---- TestStatus::TestStatus( Status status ) : status_( status ) + , assertionCount_( 0 ) + , failedAssertionCount_( 0 ) + , ignoredFailureCount_( 0 ) { } *************** *** 180,183 **** --- 197,238 ---- } + int + TestStatus::assertionCount() const + { + return assertionCount_; + } + + int + TestStatus::failedAssertionCount() const + { + return failedAssertionCount_; + } + + int + TestStatus::ignoredFailureCount() const + { + return ignoredFailureCount_; + } + + void + TestStatus::increaseAssertionCount( int delta ) + { + assertionCount_ += delta; + } + + void + TestStatus::increaseFailedAssertionCount( int delta ) + { + failedAssertionCount_ += delta; + if ( failedAssertionCount_ > 0 && status_ != failed ) + status_ = failed; + } + + void + TestStatus::increaseIgnoredFailureCount( int delta ) + { + ignoredFailureCount_ += delta; + } + // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// *************** *** 200,206 **** TestInfo::TestInfo() : assertionType_( abortingAssertion ) - , assertionCount_( 0 ) - , failedAssertionCount_( 0 ) - , ignoredAssertionCount_( 0 ) , updater_( 0 ) { --- 255,258 ---- *************** *** 214,217 **** --- 266,276 ---- } + + void + TestInfo::removeTestResultUpdater() + { + updater_ = 0; + } + void TestInfo::startNewTest() *************** *** 219,225 **** testStatus_ = TestStatus( TestStatus::passed ); currentAssertion_ = Assertion(); - assertionCount_ = 0; - failedAssertionCount_ = 0; - ignoredAssertionCount_ = 0; assertionType_ = abortingAssertion; } --- 278,281 ---- *************** *** 227,234 **** TestStatus & ! TestInfo::getUpdatedTestStatus() { - if ( !testStatus_.hasFailed() && failedAssertionCount_ > 0 ) - testStatus_.setStatus( TestStatus::failed ); return testStatus_; } --- 283,288 ---- TestStatus & ! TestInfo::testStatus() { return testStatus_; } *************** *** 237,249 **** void TestInfo::newAssertion( AssertionType type, ! const char *fileName, ! unsigned int lineNumber, ! const char *functionName ) { currentAssertion_ = Assertion( Assertion::assertion, ! SourceLocation( fileName, ! lineNumber, ! functionName ) ); ! ++assertionCount_; assertionType_ = type; } --- 291,303 ---- void TestInfo::newAssertion( AssertionType type, ! const char *fileName, ! unsigned int lineNumber, ! const char *functionName ) { currentAssertion_ = Assertion( Assertion::assertion, ! SourceLocation( fileName, ! lineNumber, ! functionName ) ); ! testStatus_.increaseAssertionCount(); assertionType_ = type; } *************** *** 260,264 **** TestInfo::realizeAssertion() { ! ++failedAssertionCount_; if ( updater_ ) --- 314,318 ---- TestInfo::realizeAssertion() { ! testStatus_.increaseFailedAssertionCount(); if ( updater_ ) *************** *** 299,309 **** - void - TestInfo::ignoredFailure() - { - ++ignoredAssertionCount_; - } - - // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// --- 353,356 ---- *************** *** 326,329 **** --- 373,422 ---- // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// + // Class IgnoreFailureScopedContextOverride + // ////////////////////////////////////////////////////////////////// + // ////////////////////////////////////////////////////////////////// + + TestInfo::IgnoreFailureScopedContextOverride::IgnoreFailureScopedContextOverride( + bool &assertionFailed ) + : assertionFailed_( assertionFailed ) + , assertion_( 0 ) + { + assertionFailed_ = false; + TestInfo::threadInstance().setTestResultUpdater( *this ); + } + + TestInfo::IgnoreFailureScopedContextOverride::~IgnoreFailureScopedContextOverride() + { + TestStatus &testStatus = TestInfo::threadInstance().testStatus(); + assertionFailed_ = !testStatus.hasPassed(); + if ( assertionFailed_ ) + { + context_->testStatus().increaseIgnoredFailureCount( testStatus.failedAssertionCount() ); + if ( assertion_ && context_->updater_ ) + { + perThreadStaticData = context_; // restore context before calling callback + assertion_->setIgnoredFailure(); + context_->updater_->addResultAssertion( *assertion_ ); + } + } + delete assertion_; + } + + void + TestInfo::IgnoreFailureScopedContextOverride::addResultLog( const Json::Value &log ) + { + } + + + void + TestInfo::IgnoreFailureScopedContextOverride::addResultAssertion( const Assertion &assertion ) + { + if ( !assertion_ ) + assertion_ = new Assertion( assertion ); + } + + + // ////////////////////////////////////////////////////////////////// + // ////////////////////////////////////////////////////////////////// // Short-hand functions in namespace CppUT // ////////////////////////////////////////////////////////////////// *************** *** 363,366 **** --- 456,464 ---- } + void log( const char *log ) + { + TestInfo::threadInstance().log( log ); + } + void log( const CppTL::ConstString &log ) { Index: testcase.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testcase.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** testcase.cpp 8 Nov 2005 21:44:55 -0000 1.13 --- testcase.cpp 11 Nov 2005 20:54:15 -0000 1.14 *************** *** 55,59 **** } ! return !TestInfo::threadInstance().getUpdatedTestStatus().hasFailed(); } --- 55,59 ---- } ! return !TestInfo::threadInstance().testStatus().hasFailed(); } |
From: Baptiste L. <bl...@us...> - 2005-11-11 20:54:24
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6524/include/cpptl Modified Files: enumerator.h Log Message: - added unit tests for TestInfo - fixed bug in CPPUT_IGNORE_FAILURE and exception guard. - added 'isIgnoredFailure' to Assertion. - lighttestrunner now print ignored failure and skipped tests. Index: enumerator.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/enumerator.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** enumerator.h 10 Nov 2005 08:03:09 -0000 1.9 --- enumerator.h 11 Nov 2005 20:54:15 -0000 1.10 *************** *** 35,39 **** namespace CppTL { namespace Enum { ! namespace Impl { --- 35,39 ---- namespace CppTL { namespace Enum { ! /// \internal namespace Impl { |
From: Baptiste L. <bl...@us...> - 2005-11-11 20:54:24
|
Update of /cvsroot/cppunit/cppunit2/examples/ignore_failure_demo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6524/examples/ignore_failure_demo Added Files: SConscript main.cpp Log Message: - added unit tests for TestInfo - fixed bug in CPPUT_IGNORE_FAILURE and exception guard. - added 'isIgnoredFailure' to Assertion. - lighttestrunner now print ignored failure and skipped tests. --- NEW FILE: main.cpp --- #include <examples/common/examplecommon.h> #include <cpput/testcase.h> static int half( int x ) { return (x+1) / 2; } static void testIgnoreFailure() { CPPUT_CHECK_EQUAL( 1, half(2) ); CPPUT_IGNORE_FAILURE(( CPPUT_CHECK_EQUAL( 2, half(5) ) )); CPPUT_CHECK_EQUAL( 5, half(10) ); } int main( int argc, const char *argv[] ) { CppUT::TestSuitePtr allSuite = CppUT::makeTestSuite( "All tests" ); allSuite->add( CppUT::makeTestCase( CppTL::cfn0( &testIgnoreFailure ), "testIgnoreFailure" ) ); return runExampleTests( argc, argv, allSuite.get() ); } --- NEW FILE: SConscript --- Import( 'env_testing buildCppUnitExample' ) buildCppUnitExample( env_testing, Split( """ main.cpp """ ), 'ignore_failure_demo' ) |
From: Baptiste L. <bl...@us...> - 2005-11-11 20:54:24
|
Update of /cvsroot/cppunit/cppunit2/makefiles/vs71 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6524/makefiles/vs71 Modified Files: cpput_test.vcproj Log Message: - added unit tests for TestInfo - fixed bug in CPPUT_IGNORE_FAILURE and exception guard. - added 'isIgnoredFailure' to Assertion. - lighttestrunner now print ignored failure and skipped tests. Index: cpput_test.vcproj =================================================================== RCS file: /cvsroot/cppunit/cppunit2/makefiles/vs71/cpput_test.vcproj,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** cpput_test.vcproj 10 Nov 2005 08:03:09 -0000 1.2 --- cpput_test.vcproj 11 Nov 2005 20:54:15 -0000 1.3 *************** *** 236,239 **** --- 236,242 ---- </File> <File + RelativePath="..\..\src\cpputtest\testinfotest.cpp"> + </File> + <File RelativePath="..\..\src\cpputtest\testtestcase.cpp"> </File> |
From: Baptiste L. <bl...@us...> - 2005-11-11 20:51:50
|
Update of /cvsroot/cppunit/cppunit2/examples/ignore_failure_demo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6041/examples/ignore_failure_demo Log Message: Directory /cvsroot/cppunit/cppunit2/examples/ignore_failure_demo added to the repository |
From: Baptiste L. <bl...@us...> - 2005-11-10 09:15:21
|
Update of /cvsroot/cppunit/cppunit2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv484 Modified Files: sconstruct Log Message: - added 'check' target to build script to run all unit tests. Index: sconstruct =================================================================== RCS file: /cvsroot/cppunit/cppunit2/sconstruct,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** sconstruct 10 Nov 2005 09:05:41 -0000 1.20 --- sconstruct 10 Nov 2005 09:15:12 -0000 1.21 *************** *** 93,96 **** --- 93,98 ---- target_check_alias = env.Alias( check_alias_name, exe, exe[0].abspath ) env.AlwaysBuild( target_check_alias ) + check_alias = env.Alias( 'check' ) + env.Depends( check_alias, target_check_alias ) def buildQTApplication( env, ui_sources, target_sources, target_name ): *************** *** 119,122 **** --- 121,126 ---- SConscript( target, build_dir=target_build_dir, duplicate=0 ) + env.Alias( 'check' ) + buildProjectInDirectory( 'src/cpput' ) buildProjectInDirectory( 'src/cpptl' ) |
From: Baptiste L. <bl...@us...> - 2005-11-10 09:05:50
|
Update of /cvsroot/cppunit/cppunit2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30485 Modified Files: sconstruct Log Message: - added check_cpput and check_opentest alias to build script to run unit tests. Index: sconstruct =================================================================== RCS file: /cvsroot/cppunit/cppunit2/sconstruct,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** sconstruct 8 Nov 2005 21:44:54 -0000 1.19 --- sconstruct 10 Nov 2005 09:05:41 -0000 1.20 *************** *** 22,39 **** SConsignFile( sconsign_path ) - ##if platform == 'suncc': - ## env = Environment( ENV = {'PATH' : os.environ['PATH']}, - ## tools=['default','suncc'] ) - ##elif platform == 'vacpp': - ## env = Environment( ENV = {'PATH' : os.environ['PATH']}, - ## CCFLAGS = '-qrtti=all', - ## tools=['default','aixcc'], - ## CXX ='xlC_r', - ## LINKFLAGS='-bh:5' ) # -bh:5 remove duplicate symbol warning - ##elif platform == 'msvc': - ## env = Environment( CCFLAGS = '-GX -GR -nologo' ) - ##elif platform == 'mingw': - ## env = Environment( tools=['default','mingw'] ) - env = Environment( ENV = {'PATH' : os.environ['PATH']}, tools=[] ) #, tools=['default'] ) --- 22,25 ---- *************** *** 67,70 **** --- 53,61 ---- env.Tool( tool ) env['CXXFLAGS']='-GR -GX /nologo' + elif platform == 'msvc80': + env['MSVS_VERSION']='8.0' + for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']: + env.Tool( tool ) + env['CXXFLAGS']='-GR -GX /nologo' elif platform == 'mingw': env.Tool( 'mingw' ) *************** *** 89,93 **** source=target_sources ) global bin_dir ! env.Install( bin_dir, exe ) def buildLibary( env, target_sources, target_name ): --- 80,85 ---- source=target_sources ) global bin_dir ! return env.Install( bin_dir, exe ) ! def buildLibary( env, target_sources, target_name ): *************** *** 97,102 **** env.Install( lib_dir, static_lib ) ! def buildLibraryUnitTest( env, target_sources, target_name ): ! buildCppUnitExample( env, target_sources, target_name ) def buildQTApplication( env, ui_sources, target_sources, target_name ): --- 89,96 ---- env.Install( lib_dir, static_lib ) ! def buildLibraryUnitTest( env, target_sources, target_name, check_alias_name ): ! exe = buildCppUnitExample( env, target_sources, target_name ) ! target_check_alias = env.Alias( check_alias_name, exe, exe[0].abspath ) ! env.AlwaysBuild( target_check_alias ) def buildQTApplication( env, ui_sources, target_sources, target_name ): |
From: Baptiste L. <bl...@us...> - 2005-11-10 09:05:50
|
Update of /cvsroot/cppunit/cppunit2/src/opentesttest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30485/src/opentesttest Modified Files: SConscript Log Message: - added check_cpput and check_opentest alias to build script to run unit tests. Index: SConscript =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentesttest/SConscript,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SConscript 4 Jul 2005 08:12:34 -0000 1.2 --- SConscript 10 Nov 2005 09:05:41 -0000 1.3 *************** *** 6,8 **** main.cpp """ ), ! 'opentesttest' ) --- 6,9 ---- main.cpp """ ), ! 'opentesttest', ! 'check_opentest' ) |
From: Baptiste L. <bl...@us...> - 2005-11-10 09:05:49
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30485/src/cpputtest Modified Files: SConscript Log Message: - added check_cpput and check_opentest alias to build script to run unit tests. Index: SConscript =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/SConscript,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** SConscript 8 Nov 2005 19:54:38 -0000 1.13 --- SConscript 10 Nov 2005 09:05:41 -0000 1.14 *************** *** 15,17 **** reflectiontest.cpp """ ), ! 'cpputtest' ) --- 15,18 ---- reflectiontest.cpp """ ), ! 'cpputtest', ! 'check_cpput' ) |
From: Baptiste L. <bl...@us...> - 2005-11-10 08:03:17
|
Update of /cvsroot/cppunit/cppunit2/makefiles/vs71 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13392/makefiles/vs71 Modified Files: cpput_test.vcproj Log Message: Fixed compilation issue on mingw platform. Index: cpput_test.vcproj =================================================================== RCS file: /cvsroot/cppunit/cppunit2/makefiles/vs71/cpput_test.vcproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** cpput_test.vcproj 6 Sep 2005 07:35:12 -0000 1.1 --- cpput_test.vcproj 10 Nov 2005 08:03:09 -0000 1.2 *************** *** 197,206 **** </File> <File - RelativePath="..\..\src\cpputtest\formattest.cpp"> - </File> - <File - RelativePath="..\..\src\cpputtest\formattest.h"> - </File> - <File RelativePath="..\..\src\cpputtest\main.cpp"> </File> --- 197,200 ---- |
From: Baptiste L. <bl...@us...> - 2005-11-10 08:03:17
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13392/include/cpptl Modified Files: any.h enumerator.h Log Message: Fixed compilation issue on mingw platform. Index: enumerator.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/enumerator.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** enumerator.h 7 Nov 2005 22:43:07 -0000 1.8 --- enumerator.h 10 Nov 2005 08:03:09 -0000 1.9 *************** *** 43,47 **** typedef CPPTL_TYPENAME Fn1::result_type result_type; ! ComposeFn( Fn1 = Fn1(), Fn2 = Fn2() ) : fn1_( fn1 ) , fn2_( fn2 ) --- 43,47 ---- typedef CPPTL_TYPENAME Fn1::result_type result_type; ! ComposeFn( Fn1 fn1= Fn1(), Fn2 fn2= Fn2() ) : fn1_( fn1 ) , fn2_( fn2 ) *************** *** 1015,1018 **** --- 1015,1019 ---- typedef AddressOfAdaptor<CPPTL_TYPENAME EnumeratorType::value_type> Adaptor; typedef TransformEnumerator< Adaptor, EnumeratorType > EnumType; + Adaptor adaptor; return EnumType( enumerator, adaptor ); } Index: any.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/any.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** any.h 3 Mar 2005 08:11:33 -0000 1.1 --- any.h 10 Nov 2005 08:03:09 -0000 1.2 *************** *** 285,291 **** const ValueType *get( const CppTL::Any *value, CppTL::Type<ValueType> ) { ! if ( value.type() != CppTL::typeId( CppTL::Type<ValueType>() ) ) return 0; ! return static_cast<CppTL::Impl::AnyHolderImpl<ValueType> *>( value.holder_ )->value(); } --- 285,291 ---- const ValueType *get( const CppTL::Any *value, CppTL::Type<ValueType> ) { ! if ( value->type() != CppTL::typeId( CppTL::Type<ValueType>() ) ) return 0; ! return static_cast<CppTL::Impl::AnyHolderImpl<ValueType> *>( value->holder_ )->value(); } |
From: Baptiste L. <bl...@us...> - 2005-11-09 23:16:14
|
Update of /cvsroot/cppunit/cppunit2/src/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12154/src/cpptl Modified Files: json_value.cpp Log Message: - removed call to strdup with null pointer Index: json_value.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpptl/json_value.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** json_value.cpp 7 Nov 2005 22:43:07 -0000 1.1 --- json_value.cpp 9 Nov 2005 23:16:05 -0000 1.2 *************** *** 36,40 **** if ( comment_ ) free( comment_ ); ! comment_ = strdup( text ); } --- 36,40 ---- if ( comment_ ) free( comment_ ); ! comment_ = text ? strdup( text ) : 0; } *************** *** 57,62 **** Value::CZString::CZString( const CZString &other ) ! : cstr_( other.index_ != noDuplication ? strdup( other.cstr_ ) ! : other.cstr_ ) , index_( other.cstr_ ? (other.index_ == noDuplication ? noDuplication : duplicate) : other.index_ ) --- 57,62 ---- Value::CZString::CZString( const CZString &other ) ! : cstr_( other.index_ != noDuplication && other.cstr_ != 0 ? strdup( other.cstr_ ) ! : other.cstr_ ) , index_( other.cstr_ ? (other.index_ == noDuplication ? noDuplication : duplicate) : other.index_ ) *************** *** 216,220 **** break; case stringValue: ! value_.string_ = strdup( other.value_.string_ ); break; case arrayValue: --- 216,223 ---- break; case stringValue: ! if ( other.value_.string_ ) ! value_.string_ = strdup( other.value_.string_ ); ! else ! value_.string_ = 0; break; case arrayValue: |
From: Baptiste L. <bl...@us...> - 2005-11-09 22:59:17
|
Update of /cvsroot/cppunit/cppunit2/src/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5189/src/opentest Modified Files: serializer.cpp Log Message: - removed infinite recursion in Serializer if there was no int64. Index: serializer.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentest/serializer.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** serializer.cpp 8 Nov 2005 20:25:49 -0000 1.11 --- serializer.cpp 9 Nov 2005 22:59:09 -0000 1.12 *************** *** 344,347 **** --- 344,348 ---- } + #ifndef CPPTL_NO_INT64 Stream & Stream::operator <<( int value ) *************** *** 357,365 **** return *this; } - - #ifndef CPPTL_NO_INT64 Stream & ! Stream::operator <<( CppTL::int64_t value ) { if ( value >= 0 ) --- 358,365 ---- return *this; } + #endif Stream & ! Stream::operator <<( LargestInt value ) { if ( value >= 0 ) *************** *** 371,380 **** Stream & ! Stream::operator <<( CppTL::uint64_t value ) { doSerializeInteger( ccPositiveInteger, value ); return *this; } - #endif void --- 371,379 ---- Stream & ! Stream::operator <<( LargestUnsignedInt value ) { doSerializeInteger( ccPositiveInteger, value ); return *this; } void |
From: Baptiste L. <bl...@us...> - 2005-11-09 22:59:16
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5189/include/opentest Modified Files: serializer.h Log Message: - removed infinite recursion in Serializer if there was no int64. Index: serializer.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/serializer.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** serializer.h 8 Nov 2005 20:25:49 -0000 1.9 --- serializer.h 9 Nov 2005 22:59:09 -0000 1.10 *************** *** 189,194 **** Stream &operator <<( unsigned int value ); #ifndef CPPTL_NO_INT64 ! Stream &operator <<( CppTL::int64_t value ); ! Stream &operator <<( CppTL::uint64_t value ); #endif Stream &operator <<( double value ); --- 189,194 ---- Stream &operator <<( unsigned int value ); #ifndef CPPTL_NO_INT64 ! Stream &operator <<( LargestInt value ); ! Stream &operator <<( LargestUnsignedInt value ); #endif Stream &operator <<( double value ); |
From: Baptiste L. <bl...@us...> - 2005-11-09 22:42:42
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2135/src/cpput Modified Files: lighttestrunner.cpp Log Message: - flush stdout during test progress. Index: lighttestrunner.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/lighttestrunner.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** lighttestrunner.cpp 8 Nov 2005 20:25:49 -0000 1.10 --- lighttestrunner.cpp 9 Nov 2005 22:42:31 -0000 1.11 *************** *** 35,47 **** if ( testFailed_ > 0 ) { ! printf( "Failure report:\n%s", report_.c_str() ); ! printf( "%d/%d tests passed, %d tests failed.", testRun_ - testFailed_, testRun_, testFailed_ ); } else { ! printf( "All %d tests passed.", testRun_ ); } return testFailed_ == 0; --- 35,50 ---- if ( testFailed_ > 0 ) { ! fprintf( stdout, "Failure report:\n%s", report_.c_str() ); ! fflush( stdout ); ! fprintf( stdout, "%d/%d tests passed, %d tests failed.", testRun_ - testFailed_, testRun_, testFailed_ ); + fflush( stdout ); } else { ! fprintf( stdout, "All %d tests passed.\n", testRun_ ); ! fflush( stdout ); } return testFailed_ == 0; *************** *** 72,76 **** LightTestRunner::runTestCase( const AbstractTestCasePtr &testCase ) { ! printf( "Testing %s : ", getTestPath().c_str() ); assertions_.clear(); logs_.clear(); --- 75,80 ---- LightTestRunner::runTestCase( const AbstractTestCasePtr &testCase ) { ! fprintf( stdout, "Testing %s : ", getTestPath().c_str() ); ! fflush( stdout ); assertions_.clear(); logs_.clear(); *************** *** 79,83 **** bool succeeded = testCase->runTest(); ! printf( "%s\n", succeeded ? "OK" : "FAIL" ); if ( !succeeded ) { --- 83,88 ---- bool succeeded = testCase->runTest(); ! fprintf( stdout, "%s\n", succeeded ? "OK" : "FAIL" ); ! fflush( stdout ); if ( !succeeded ) { |
From: Baptiste L. <bl...@us...> - 2005-11-09 22:04:07
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24863/include/cpptl Modified Files: atomiccounter.h config.h Log Message: - removed support for atomic counter on linux (warning on include, don't work reliably) Index: config.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/config.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** config.h 6 Sep 2005 07:14:49 -0000 1.20 --- config.h 9 Nov 2005 22:03:56 -0000 1.21 *************** *** 71,75 **** # elif defined(linux) || defined(__linux) || defined(__linux__) # define CPPTL_USE_PTHREAD_THREAD 1 - # define CPPTL_USE_LINUX_ATOMIC 1 # elif defined(sun) || defined(__sun) # define CPPTL_USE_PTHREAD_THREAD 1 --- 71,74 ---- *************** *** 138,145 **** # if !CPPTL_HAS_THREAD_SAFE_ATOMIC_COUNTER ! # if CPPTL_USE_PTHREAD_THREAD && !CPPTL_USE_WIN32_ATOMIC && !CPPTL_USE_LINUX_ATOMIC # define CPPTL_USE_PTHREAD_ATOMIC 1 # endif ! # if CPPTL_USE_PTHREAD_ATOMIC || CPPTL_USE_WIN32_ATOMIC || CPPTL_USE_LINUX_ATOMIC # define CPPTL_HAS_THREAD_SAFE_ATOMIC_COUNTER 1 # endif --- 137,144 ---- # if !CPPTL_HAS_THREAD_SAFE_ATOMIC_COUNTER ! # if CPPTL_USE_PTHREAD_THREAD && !CPPTL_USE_WIN32_ATOMIC # define CPPTL_USE_PTHREAD_ATOMIC 1 # endif ! # if CPPTL_USE_PTHREAD_ATOMIC || CPPTL_USE_WIN32_ATOMIC # define CPPTL_HAS_THREAD_SAFE_ATOMIC_COUNTER 1 # endif Index: atomiccounter.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/atomiccounter.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** atomiccounter.h 7 Mar 2005 21:34:44 -0000 1.8 --- atomiccounter.h 9 Nov 2005 22:03:55 -0000 1.9 *************** *** 3,9 **** # include <cpptl/config.h> ! # if CPPTL_USE_LINUX_ATOMIC ! # include <asm/atomic.h> ! # elif CPPTL_USE_PTHREAD_ATOMIC # include <pthread.h> # endif --- 3,7 ---- # include <cpptl/config.h> ! # if CPPTL_USE_PTHREAD_ATOMIC # include <pthread.h> # endif *************** *** 116,157 **** }; - // ////////////////////////////////////////////////////////////////// - // ////////////////////////////////////////////////////////////////// - // AtomicCounter implementation for Linux - // ////////////////////////////////////////////////////////////////// - // ////////////////////////////////////////////////////////////////// - #elif CPPTL_USE_LINUX_ATOMIC - - - class CPPTL_API AtomicCounter : public NonCopyable - { - public: - AtomicCounter( long count = 0 ) - { - atomic_t value = ATOMIC_INIT(count); - count_ = value; - } - - - void increment() - { - atomic_inc( &count_ ); - } - - - bool decrement() - { - return !atomic_dec_and_test( &count_ ); - } - - - long count() const - { - return atomic_read( &count_ ); - } - - private: - atomic_t count_; - }; --- 114,117 ---- |
From: Baptiste L. <bl...@us...> - 2005-11-09 21:45:16
|
Update of /cvsroot/cppunit/cppunit2/src/opentesttest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19843/src/opentesttest Modified Files: serializertest.cpp Log Message: - removed warning on linux-gcc Index: serializertest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentesttest/serializertest.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** serializertest.cpp 8 Nov 2005 23:25:31 -0000 1.6 --- serializertest.cpp 9 Nov 2005 21:45:08 -0000 1.7 *************** *** 62,66 **** streamIn_.packets().write( buffer, length ); streamIn_.packets().endWriteMessage(); ! delete [] buffer; } --- 62,66 ---- streamIn_.packets().write( buffer, length ); streamIn_.packets().endWriteMessage(); ! delete [] (char *)buffer; } |
From: Baptiste L. <bl...@us...> - 2005-11-09 21:40:42
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19014/include/cpput Modified Files: registry.h Log Message: - simplified ...SUITE_IN macros. Index: registry.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/registry.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** registry.h 8 Nov 2005 23:25:31 -0000 1.6 --- registry.h 9 Nov 2005 21:40:29 -0000 1.7 *************** *** 80,84 **** namespace Impl { ! struct RegisterToNamedSuiteTag {}; } // namespace Impl --- 80,86 ---- namespace Impl { ! enum RegisterToNamedSuiteTag { ! registerToNamedSuite ! }; } // namespace Impl *************** *** 145,150 **** #define CPPUT_REGISTER_SUITE_IN( TestFixtureType, parentSuiteName ) \ static CppUT::SuiteRegisterer< TestFixtureType > \ ! CPPTL_MAKE_UNIQUE_NAME(cpputSuiteRegisterer )( \ ! CppUT::Impl::RegisterToNamedSuiteTag(), \ parentSuiteName ); --- 147,152 ---- #define CPPUT_REGISTER_SUITE_IN( TestFixtureType, parentSuiteName ) \ static CppUT::SuiteRegisterer< TestFixtureType > \ ! CPPTL_MAKE_UNIQUE_NAME(cpputSuiteRegisterer)( \ ! CppUT::Impl::registerToNamedSuite, \ parentSuiteName ); *************** *** 155,160 **** static CppUT::SuiteRegisterer< TestFixtureType > \ CPPTL_MAKE_UNIQUE_NAME(cpputSuiteRegisterer )( \ ! CppUT::Impl::RegisterToNamedSuiteTag(), \ ! parentSuiteName, \ suiteName ); --- 157,162 ---- static CppUT::SuiteRegisterer< TestFixtureType > \ CPPTL_MAKE_UNIQUE_NAME(cpputSuiteRegisterer )( \ ! CppUT::Impl::registerToNamedSuite, \ ! parentSuiteName, \ suiteName ); |
From: Baptiste L. <bl...@us...> - 2005-11-09 21:16:52
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13122/include/cpptl Modified Files: typeinfo.h Log Message: - added declaration of compile type RTTI macro even if RTTI is enabled. Index: typeinfo.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/typeinfo.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** typeinfo.h 6 Sep 2005 07:17:36 -0000 1.2 --- typeinfo.h 9 Nov 2005 21:16:41 -0000 1.3 *************** *** 55,58 **** --- 55,60 ---- + #define CPPTL_DECLARE_TYPEINFO( AType ) + #define CPPTL_DECLARE_TYPE_AND_PTR_INFO( AType ) // ///////////////////////////////////////////////////// |
From: Baptiste L. <bl...@us...> - 2005-11-09 20:04:14
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28417/src/cpput Modified Files: assert.cpp exceptionguard.cpp testinfo.cpp Log Message: - added CPPUT_SKIP_TEST to skip the current test - added CPPUT_IGNORE_FAILURE( assertion ) to ignore a failure caused by an assertion, but count the failed assertion Index: assert.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/assert.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** assert.cpp 8 Nov 2005 21:44:54 -0000 1.15 --- assert.cpp 9 Nov 2005 20:04:06 -0000 1.16 *************** *** 117,120 **** --- 117,130 ---- + void + skipCurrentTest() + { + TestStatus &status = TestInfo::threadInstance().getUpdatedTestStatus(); + if ( status.hasPassed() ) + status.setStatus( TestStatus::skipped ); + throw SkipTestException(); + } + + } // namespace CppUT Index: testinfo.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testinfo.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** testinfo.cpp 8 Nov 2005 21:44:55 -0000 1.18 --- testinfo.cpp 9 Nov 2005 20:04:06 -0000 1.19 *************** *** 148,151 **** --- 148,163 ---- } + bool + TestStatus::hasPassed() const + { + return status_ == passed; + } + + bool + TestStatus::wasSkipped() const + { + return status_ == skipped; + } + void TestStatus::setStatistics( const std::string &name, *************** *** 190,193 **** --- 202,206 ---- , assertionCount_( 0 ) , failedAssertionCount_( 0 ) + , ignoredAssertionCount_( 0 ) , updater_( 0 ) { *************** *** 208,211 **** --- 221,225 ---- assertionCount_ = 0; failedAssertionCount_ = 0; + ignoredAssertionCount_ = 0; assertionType_ = abortingAssertion; } *************** *** 285,288 **** --- 299,309 ---- + void + TestInfo::ignoredFailure() + { + ++ignoredAssertionCount_; + } + + // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// Index: exceptionguard.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/exceptionguard.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** exceptionguard.cpp 10 Aug 2005 21:34:29 -0000 1.7 --- exceptionguard.cpp 9 Nov 2005 20:04:06 -0000 1.8 *************** *** 32,38 **** { if ( deleguate_ ) ! return deleguate_->protect( context ); ! context.test_(); ! return true; } --- 32,39 ---- { if ( deleguate_ ) ! deleguate_->protect( context ); ! else ! context.test_(); ! return !(TestInfo::threadInstance().getUpdatedTestStatus().hasFailed()); } |
From: Baptiste L. <bl...@us...> - 2005-11-09 20:04:13
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28417/include/cpput Modified Files: assert.h testinfo.h Log Message: - added CPPUT_SKIP_TEST to skip the current test - added CPPUT_IGNORE_FAILURE( assertion ) to ignore a failure caused by an assertion, but count the failed assertion Index: testinfo.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testinfo.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** testinfo.h 8 Nov 2005 21:44:54 -0000 1.16 --- testinfo.h 9 Nov 2005 20:04:06 -0000 1.17 *************** *** 6,9 **** --- 6,10 ---- # include <cpptl/intrusiveptr.h> # include <json/value.h> + # include <stdexcept> /// @todo find a away to integrate context with multiple thread. *************** *** 20,23 **** --- 21,33 ---- }; + class CPPUT_API SkipTestException : public std::runtime_error + { + public: + SkipTestException() + : std::runtime_error( "SkipTestException" ) + { + } + }; + class SourceLocation { *************** *** 108,111 **** --- 118,123 ---- bool hasFailed() const; + bool hasPassed() const; + bool wasSkipped() const; void setStatistics( const std::string &name, *************** *** 185,188 **** --- 197,202 ---- void setAbortingAssertionMode( AbortingAssertionMode mode ); + void ignoredFailure(); + void log( const Json::Value &log ); *************** *** 195,198 **** --- 209,213 ---- unsigned int assertionCount_; unsigned int failedAssertionCount_; + unsigned int ignoredAssertionCount_; }; Index: assert.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/assert.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** assert.h 8 Nov 2005 21:44:54 -0000 1.14 --- assert.h 9 Nov 2005 20:04:06 -0000 1.15 *************** *** 114,117 **** --- 114,119 ---- const Message &message = Message() ); + void CPPUT_API skipCurrentTest(); + } // namespace CppUT *************** *** 132,136 **** CPPUT_CHECK_POINT( checkingAssertion ), - // basic assertions # define CPPUT_FAIL \ --- 134,137 ---- *************** *** 245,258 **** { \ CPPUT_CHECK_POINT( assertionType ); \ ! bool assertionFailed = false; \ { \ ! ::CppUT::TestInfo::ScopedContextOverride contextSwitch; \ try { \ assertion; \ } catch ( const ::CppUT::AbortingAssertionException & ) { \ } \ ! assertionFailed = ::CppUT::TestInfo::threadInstance().getUpdatedTestStatus().hasFailed(); \ } \ ! ::CppUT::checkAssertionFail( assertionFailed, message ); \ } --- 246,259 ---- { \ CPPUT_CHECK_POINT( assertionType ); \ ! bool assertionFailedCppUT_ = false; \ { \ ! ::CppUT::TestInfo::ScopedContextOverride contextSwitchCppUT_; \ try { \ assertion; \ } catch ( const ::CppUT::AbortingAssertionException & ) { \ } \ ! assertionFailedCppUT_ = ::CppUT::TestInfo::threadInstance().getUpdatedTestStatus().hasFailed(); \ } \ ! ::CppUT::checkAssertionFail( assertionFailedCppUT_, message ); \ } *************** *** 272,285 **** { \ CPPUT_CHECK_POINT( assertionType ); \ ! bool assertionFailed = false; \ { \ ! ::CppUT::TestInfo::ScopedContextOverride contextSwitch; \ try { \ assertion; \ } catch ( const ::CppUT::AbortingAssertionException & ) { \ } \ ! assertionFailed = ::CppUT::TestInfo::threadInstance().getUpdatedTestStatus().hasFailed(); \ } \ ! ::CppUT::checkAssertionPass( assertionFailed, message ); \ } --- 273,286 ---- { \ CPPUT_CHECK_POINT( assertionType ); \ ! bool assertionFailedCppUT_ = false; \ { \ ! ::CppUT::TestInfo::ScopedContextOverride contextSwitchCppUT_; \ try { \ assertion; \ } catch ( const ::CppUT::AbortingAssertionException & ) { \ } \ ! assertionFailedCppUT_ = ::CppUT::TestInfo::threadInstance().getUpdatedTestStatus().hasFailed(); \ } \ ! ::CppUT::checkAssertionPass( assertionFailedCppUT_, message ); \ } *************** *** 296,299 **** --- 297,317 ---- CPPUT_CHECK_ASSERTION_PASS_MESSAGE( assertion, ::CppUT::Message() ) + # define CPPUT_SKIP_TEST \ + ::CppUT::skipCurrentTest + + # define CPPUT_IGNORE_FAILURE( assertion ) \ + { \ + bool succeedCppUT_ = false; \ + { \ + ::CppUT::TestInfo::ScopedContextOverride contextSwitchCppUT_; \ + try { \ + assertion; \ + } catch ( const ::CppUT::AbortingAssertionException & ) { \ + } \ + succeedCppUT_ = ::CppUT::TestInfo::threadInstance().getUpdatedTestStatus().hasPassed(); \ + } \ + ::CppUT::checkAssertionFail( !succeedCppUT_, #assertion ); \ + ::CppUT::TestInfo::threadInstance().ignoredFailure(); \ + } #endif // CPPUT_ASSERT_H_INCLUDED |