[Cppunit-cvs] cppunit2/include/cpput testinfo.h,NONE,1.1 forwards.h,1.10,1.11
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2004-11-18 09:20:44
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13378/include/cpput Modified Files: forwards.h Added Files: testinfo.h Log Message: * started implementing assertion support for both checking and aborting assertion * TestInfo to send incremental update on the test result to the test driver (logging...) --- NEW FILE: testinfo.h --- #ifndef CPPUT_TESTINFO_H_INCLUDED # define CPPUT_TESTINFO_H_INCLUDED # include <cpput/forwards.h> # include <opentest/properties.h> namespace CppUT { class CPPUT_API AbortingAssertionException : public std::runtime_error { public: AbortingAssertionException( const std::string &message ) : std::runtime_error( "AbortingAssertionException:\n" + message ) { } }; class CPPUT_API TestResultUpdater { public: virtual ~TestResultUpdater() { } virtual void mergeInResult( const std::string &path, const OpenTest::Value &value ) = 0; virtual void appendToResult( const std::string &path, const OpenTest::Value &value ) = 0; }; enum AssertionType { abortingAssertion = 1, checkingAssertion }; namespace TestInfo { void CPPUT_API setTestResultUpdater( const TestResultUpdaterPtr &updater ); void CPPUT_API startNewTest(); OpenTest::PropertiesAccessor CPPUT_API result(); void CPPUT_API newAssertion(); void CPPUT_API setAssertionType( AssertionType type ); AssertionType CPPUT_API assertionType(); void CPPUT_API setAssertionLocation( const char *fileName, unsigned int lineNumber, const char *functionName = 0 ); OpenTest::Properties &CPPUT_API currentAssertion(); /// Realize the current assertion. /// Add data about the current assertion to the test result. /// @exception AbortingAssertionException If assertionType was set to /// abortingAssertion. void CPPUT_API realizeAssertion(); void CPPUT_API mergeInResult( const std::string &path, const OpenTest::Value &value ); void CPPUT_API appendToResult( const std::string &path, const OpenTest::Value &value ); /// Only for using for unit test of the framework itself TestInfoDataPtr CPPUT_API saveAndResetContext(); /// Only for using for unit test of the framework itself void CPPUT_API restoreContext( const TestInfoDataPtr &oldContext ); } // namespace TestInfo } // namespace CppUT #endif // CPPUT_TESTINFO_H_INCLUDED Index: forwards.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/forwards.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** forwards.h 17 Nov 2004 21:47:09 -0000 1.10 --- forwards.h 18 Nov 2004 09:20:34 -0000 1.11 *************** *** 8,11 **** --- 8,12 ---- namespace CppUT { + class AbortingAssertionException; class AbstractTestCase; class AbstractTestSuite; *************** *** 25,29 **** --- 26,32 ---- class TestExceptionGuard; class TestExceptionGuardChain; + class TestInfoData; class TestListener; + class TestResultUpdater; class TestSuite; class TestVisitor; *************** *** 31,35 **** --- 34,40 ---- typedef CppTL::SharedPtr<Test> TestPtr; typedef CppTL::SharedPtr<TestExceptionGuard> TestExceptionGuardPtr; + typedef CppTL::SharedPtr<TestInfoData> TestInfoDataPtr; typedef CppTL::SharedPtr<AbstractTestSuite> AbstractTestSuitePtr; + typedef CppTL::SharedPtr<TestResultUpdater> TestResultUpdaterPtr; typedef CppTL::SharedPtr<TestSuite> TestSuitePtr; |