Update of /cvsroot/cpptool/CppParser/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20897/include/cpput Modified Files: assert.h config.h enumerator.h forwards.h message.h properties.h test.h testcontext.h testfailureguard.h testlistener.h Added Files: progresslistener.h resource.h resultexception.h tablefixture.h testresult.h testrunresult.h Removed Files: assertexception.h result.h testfailure.h Log Message: * upgraded to current cppunit 2 cvs --- result.h DELETED --- --- NEW FILE: progresslistener.h --- #ifndef CPPUT_PROGRESSLISTENER_H_INCLUDED # define CPPUT_PROGRESSLISTENER_H_INCLUDED # include <cpput/test.h> # include <cpput/testlistener.h> # include <cpput/testresult.h> # include <iostream> namespace CppUT { class CPPUT_API BriefProgressListener : public TestListener { public: // overridden from CppUT::TestListener void processTestResult( CppUT::TestResult &result, CppUT::TestContext &context ) { if ( result.failed() ) { if ( result.isAssertionFailure() ) resultType_ = "ASSERTION"; else if ( result.isFaultFailure() ) resultType_ = "FAULT"; else // user custom failure resultType_ = "FAILURE"; } } void enterTest( CppUT::Test &test, CppUT::TestContext &context ) { resultType_ = "OK"; std::cout << "Testing '" << path( test ) << "' : "; std::cout.flush(); } void exitTest( CppUT::Test &test, CppUT::TestContext &context ) { std::cout << resultType_ << std::endl; } std::string resultType_; }; class CPPUT_API DotProgressListener : public TestListener { public: // overridden from CppUT::TestListener void processTestResult( CppUT::TestResult &result, CppUT::TestContext &context ) { char out = '.'; if ( result.failed() ) { if ( result.isAssertionFailure() ) out = 'A'; else if ( result.isFaultFailure() ) out = 'F'; else // user custom failure out = 'E'; } std::cout << out; std::cout.flush(); } }; } // namespace CppUT #endif // CPPUT_PROGRESSLISTENER_H_INCLUDED --- NEW FILE: resultexception.h --- #ifndef CPPUT_RESULTEXCEPTION_H_INCLUDED # define CPPUT_RESULTEXCEPTION_H_INCLUDED # include <cpput/config.h> # include <cpput/location.h> # include <cpput/message.h> # include <exception> // TODO: operator =() default implementation bugged in VC 6. See CppUnit 1.9 for work-around. namespace CppUT { class CPPUT_API ResultException : public std::exception { public: ResultException( const Message &message, const Location &location = Location() ) : location_( location ) , message_( message ) , messageAdjusted_( false ) { } ResultException( const ResultException &other ) : location_( other.location_ ) , message_( other.message() ) // retrieves adjusted message , messageAdjusted_( true ) { } virtual ~ResultException() // CPPUT_STD_EXCEPTION_THROW_CLAUSE { } ResultException &operator =( const ResultException &other ) { // Don't call superclass operator =(). VC++ 6.0 STL implementation // has a bug. It calls the destructor and copy constructor of // std::exception() which reset the virtual table to std::exception. // SuperClass::operator =(other); location_ = other.location_; message_ = other.message(); // retrieves adjusted message messageAdjusted_ = true; return *this; } const Location &location() const { return location_; } const Message &message() const { adjustMessage(); return message_; } // overridden from std::exception const char *what() const throw() { if ( what_.empty() ) { adjustMessage(); what_ = "Failure at "; what_ += location_.toString(); what_ += "\n"; what_ += message_.toString(); } return what_.c_str(); } protected: /// Should be overriden to set test status and result type. virtual void doAdjustMessage( Message &message ) const { } private: void adjustMessage() const { if ( messageAdjusted_ ) return; doAdjustMessage( message_ ); messageAdjusted_ = true; } mutable std::string what_; Location location_; mutable Message message_; mutable bool messageAdjusted_; }; class CPPUT_API SuccessException : public ResultException { public: SuccessException( const Message &message, const Location &location = Location() ) : ResultException( message, location ) { } protected: // overriden from ResultException void doAdjustMessage( Message &message ) const { message.setStatus( true ); } }; class CPPUT_API FailureException : public ResultException { public: FailureException( const Message &message, const Location &location = Location() ) : ResultException( message, location ) { } protected: // overriden from ResultException void doAdjustMessage( Message &message ) const { message.setStatus( false ); } }; class CPPUT_API AssertException : public FailureException { public: AssertException( const Message &message, const Location &location = Location() ) : FailureException( message, location ) { } protected: // overriden from ResultException void doAdjustMessage( Message &message ) const { FailureException::doAdjustMessage( message ); if ( !message.hasResultType() ) // allow user to set a custom result type message.setResultType( "assertion" ); } }; class CPPUT_API FaultException : public FailureException { public: FaultException( const Message &message, const Location &location = Location() ) : FailureException( message, location ) { } protected: // overriden from ResultException void doAdjustMessage( Message &message ) const { FailureException::doAdjustMessage( message ); if ( !message.hasResultType() ) // allow user to set a custom result type message.setResultType( "fault" ); } }; } // namespace CppUT #endif // CPPUT_RESULTEXCEPTION_H_INCLUDED --- assertexception.h DELETED --- Index: config.h =================================================================== RCS file: /cvsroot/cpptool/CppParser/include/cpput/config.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** config.h 8 Jun 2004 20:23:20 -0000 1.1.1.1 --- config.h 5 Aug 2004 20:52:45 -0000 1.2 *************** *** 37,40 **** --- 37,42 ---- # define CPPUT_HAS_FUNCTION_TEMPLATE_ORDERING 1 # define CPPUT_HAS_TEMPLATE_PARTIAL_SPECIALIZATION 1 + # pragma warning( disable : 4800 ) // forcing value to bool performance warning + # pragma warning( disable : 4018 ) // '<' signed/unsigned mismatch # endif --- NEW FILE: testresult.h --- #ifndef CPPUT_TESTFAILURE_H_INCLUDED # define CPPUT_TESTFAILURE_H_INCLUDED # include <cpput/config.h> # include <cpput/forwards.h> # include <cpput/location.h> # include <cpput/message.h> namespace CppUT { /// @todo make succeeded a property like failure_type. class CPPUT_API TestResult { public: TestResult( Test &test, const Message &message ) : test_( &test ) , message_( message ) { } TestResult( Test &test, const Message &message, const Location &location ) : test_( &test ) , message_( message ) , location_( location ) { } bool succeeded() const { return get<bool>( properties().tryGet( "cpput.status", false ) ); } bool failed() const { return !succeeded(); } bool isFaultFailure() const { return resultType() == "fault"; } bool isAssertionFailure() const { return resultType() == "assertion"; } std::string resultType() const { return get<std::string>( properties().tryGet( "cpput.result_type", std::string("") ) ); } Test &test() const { return *test_; } const Properties &properties() const { return message_.properties(); } const Message &message() const { return message_; } const Location &location() const { return location_; } private: Test *test_; Message message_; Location location_; }; } // namespace CppUT #endif // CPPUT_TESTFAILURE_H_INCLUDED Index: testfailureguard.h =================================================================== RCS file: /cvsroot/cpptool/CppParser/include/cpput/testfailureguard.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** testfailureguard.h 8 Jun 2004 20:23:21 -0000 1.1.1.1 --- testfailureguard.h 5 Aug 2004 20:52:45 -0000 1.2 *************** *** 3,12 **** # include <cpput/forwards.h> ! # include <cpput/assertexception.h> # include <cpput/functor.h> # include <deque> # include <stdexcept> ! /* Tests setUp(), tearDown(), run() call are protected by a TestFailureGuardChain. * * This guard chain ensures that any exceptions thrown by the call is caught and properly handled. --- 3,12 ---- # include <cpput/forwards.h> ! # include <cpput/resultexception.h> # include <cpput/functor.h> # include <deque> # include <stdexcept> ! /* Tests setUp(), tearDown(), run() call are protected by a TestExceptionGuardChain. * * This guard chain ensures that any exceptions thrown by the call is caught and properly handled. *************** *** 14,18 **** * std::exception, and any other exception. * ! * A TestFailureGuard can be added to the guard chain to handle exception type unknown * to the test framework which are not derived from std::exception (MFC CException * for example). */ --- 14,18 ---- * std::exception, and any other exception. * ! * A TestExceptionGuard can be added to the guard chain to handle exception type unknown * to the test framework which are not derived from std::exception (MFC CException * for example). */ *************** *** 20,68 **** namespace CppUT { - namespace Impl { - template<class ExceptionType> - struct FailureData - { - FailureData( Test &failedTest, const ExceptionType &e ) - : failedTest_( failedTest ) - , exception_( e ) - { - } - - Test &failedTest_; - ExceptionType exception_; - }; - } // namespace Impl - - // Test fault & assertion failure are forwarded to that handler. ! class CPPUT_API TestFailureHandler { public: ! virtual ~TestFailureHandler() { } ! virtual void handleAssertion( Test &failedTest, const AssertException &e ) = 0; ! ! virtual void handleFault( Test &failedTest, const FaultException &e ) =0; }; ! class CPPUT_API TestFailureGuard { public: ! virtual ~TestFailureGuard() { } ! void setNextInChain( const TestFailureGuardPtr &deleguate ); struct Context { ! Context( TestFailureHandler &failureHandler, Functor0 test, Test &protectedTest ) ! : failureHandler_( failureHandler ) , test_( test ) , protectedTest_( protectedTest ) --- 20,50 ---- namespace CppUT { // Test fault & assertion failure are forwarded to that handler. ! class CPPUT_API TestExceptionHandler { public: ! virtual ~TestExceptionHandler() { } ! virtual void handleResultException( Test &test, const ResultException &e ) = 0; }; ! class CPPUT_API TestExceptionGuard { public: ! virtual ~TestExceptionGuard() { } ! void setNextInChain( const TestExceptionGuardPtr &deleguate ); struct Context { ! Context( TestExceptionHandler &exceptionHandler, Functor0 test, Test &protectedTest ) ! : exceptionHandler_( exceptionHandler ) , test_( test ) , protectedTest_( protectedTest ) *************** *** 70,74 **** } ! TestFailureHandler &failureHandler_; Functor0 test_; Test &protectedTest_; --- 52,56 ---- } ! TestExceptionHandler &exceptionHandler_; Functor0 test_; Test &protectedTest_; *************** *** 82,99 **** private: ! TestFailureGuardPtr deleguate_; }; ! class CPPUT_API TestFailureGuardChain { public: ! TestFailureGuardChain(); ! void appendGuard( const TestFailureGuardPtr &guard ); void removeGuard(); ! bool protect( TestFailureHandler &failureHandler, Functor0 test, Test &protectedTest ); --- 64,81 ---- private: ! TestExceptionGuardPtr deleguate_; }; ! class CPPUT_API TestExceptionGuardChain { public: ! TestExceptionGuardChain(); ! void appendGuard( const TestExceptionGuardPtr &guard ); void removeGuard(); ! bool protect( TestExceptionHandler &exceptionHandler, Functor0 test, Test &protectedTest ); *************** *** 102,142 **** private: ! typedef std::deque<TestFailureGuardPtr> Guards; Guards guards_; }; ! class CPPUT_API FailuresPropagationException : public std::exception { public: ! FailuresPropagationException(); ! virtual ~FailuresPropagationException() // CPPUT_STD_EXCEPTION_THROW_CLAUSE { } ! void addAssertion( Test &failedTest, ! const AssertException &e ); ! void addFault( Test &failedTest, ! const FaultException &e ); ! bool hasFailures() const; ! void handleFailures( TestFailureHandler &handler ) const; ! private: ! typedef Impl::FailureData<AssertException> AssertionData; ! typedef Impl::FailureData<FaultException> FaultData; ! std::deque<AssertionData> assertions_; ! std::deque<FaultData> faults_; }; /* ! class CPPUT_API ThreadGuard : public TestFailureGuardChain { public: ThreadGuard(); ! ThreadGuard( const TestFailureGuardChain &other ); }; */ --- 84,128 ---- private: ! typedef std::deque<TestExceptionGuardPtr> Guards; Guards guards_; }; ! class CPPUT_API TestResultsPropagationException : public std::exception { public: ! TestResultsPropagationException(); ! virtual ~TestResultsPropagationException() // CPPUT_STD_EXCEPTION_THROW_CLAUSE { } ! void addResult( Test &test, ! const ResultException &e ); ! void handleFailures( TestExceptionHandler &handler ) const; ! private: ! struct ResultData ! { ! ResultData( Test &test, const ResultException &e ) ! : test_( test ) ! , exception_( e ) ! { ! } ! Test &test_; ! ResultException exception_; ! }; ! std::deque<ResultData> results_; }; /* ! class CPPUT_API ThreadGuard : public TestExceptionGuardChain { public: ThreadGuard(); ! ThreadGuard( const TestExceptionGuardChain &other ); }; */ --- NEW FILE: resource.h --- #ifndef CPPUT_RESOURCE_H_INCLUDED # define CPPUT_RESOURCE_H_INCLUDED # include <cpput/smartptr.h> /* * Notes: * 1) it would be interesting to use the dependency injection pattern for test fixture * that use resource. This would allows the fixture to be run with different resources, making * it simple to run different set of input/expected set on the same fixture. * * 2) the above seems to relate to some of the tablefixture ideas... */ namespace CppUT { class Resource; typedef SmartPtr<Resource> ResourcePtr; class CPPUT_API Resource { public: virtual ~Resource() { } virtual void setUp() { } virtual void cleanUp() { } }; class CPPUT_API ResourceProvider { public: virtual ~ResourceProvider() { } virtual std::string handledProtocol() const = 0; virtual ResourcePtr makeResource( const std::string &uri ) = 0; }; class CPPUT_API InjectResource { public: virtual ~InjectResource() { } virtual void setResource( const std::string &uri, const ResourcePtr &resource ) = 0; }; template<class FixtureType> class SharedFixtureResourceProvider : public ResourceProvider { public: // overridden from ResourceProvider std::string handledProtocol() const { return "shared_fixture"; } ResourcePtr makeResource( const std::string &uri ) { return ResourcePtr<FixtureType>(); } }; } // namespace CppUT #endif // CPPUT_RESOURCE_H_INCLUDED --- testfailure.h DELETED --- Index: test.h =================================================================== RCS file: /cvsroot/cpptool/CppParser/include/cpput/test.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** test.h 8 Jun 2004 20:23:21 -0000 1.1.1.1 --- test.h 5 Aug 2004 20:52:45 -0000 1.2 *************** *** 64,67 **** --- 64,75 ---- + inline std::string CPPUT_API path( Test &test ) + { + if ( test.parentTest() ) + return path( *test.parentTest() ) + "/" + test.name(); + return test.name(); + } + + } // namespace CppUT Index: forwards.h =================================================================== RCS file: /cvsroot/cpptool/CppParser/include/cpput/forwards.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** forwards.h 8 Jun 2004 20:23:20 -0000 1.1.1.1 --- forwards.h 5 Aug 2004 20:52:45 -0000 1.2 *************** *** 9,23 **** class AbstractTestSuite; class AssertException; class FaultException; class Location; class Message; ! class StandardTestFailureGuard; class Test; class TestCase; class TestContext; ! class TestFailure; ! class TestFailureHandler; ! class TestFailureGuard; ! class TestFailureGuardChain; class TestListener; class TestSuite; --- 9,26 ---- class AbstractTestSuite; class AssertException; + class FailureException; class FaultException; class Location; class Message; ! class ResultException; ! class StandardTestExceptionGuard; ! class SuccessException; class Test; class TestCase; class TestContext; ! class TestResult; ! class TestExceptionHandler; ! class TestExceptionGuard; ! class TestExceptionGuardChain; class TestListener; class TestSuite; *************** *** 25,29 **** typedef SmartPtr<Test> TestPtr; ! typedef SmartPtr<TestFailureGuard> TestFailureGuardPtr; typedef SmartPtr<TestSuite> TestSuitePtr; --- 28,32 ---- typedef SmartPtr<Test> TestPtr; ! typedef SmartPtr<TestExceptionGuard> TestExceptionGuardPtr; typedef SmartPtr<TestSuite> TestSuitePtr; Index: assert.h =================================================================== RCS file: /cvsroot/cpptool/CppParser/include/cpput/assert.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** assert.h 8 Jun 2004 20:23:19 -0000 1.1.1.1 --- assert.h 5 Aug 2004 20:52:41 -0000 1.2 *************** *** 2,6 **** # define CPPUT_ASSERT_H_INCLUDED ! # include <cpput/assertexception.h> # include <cpput/equality.h> # include <cpput/location.h> --- 2,6 ---- # define CPPUT_ASSERT_H_INCLUDED ! # include <cpput/resultexception.h> # include <cpput/equality.h> # include <cpput/location.h> *************** *** 18,21 **** --- 18,23 ---- void CPPUT_API fail( const Message &message = translate( "Assertion failed." ) ); + void CPPUT_API succeed( const Message &message ); + void CPPUT_API checkTrue( bool shouldBeTrue, const Message &message = Message() ); *************** *** 123,126 **** --- 125,132 ---- ::CppUT::fail + # define CPPUT_SUCCEED \ + CPPUT_BEGIN_ASSERTION_MACRO() \ + ::CppUT::succeed + # define CPPUT_ASSERT \ CPPUT_BEGIN_ASSERTION_MACRO() \ Index: properties.h =================================================================== RCS file: /cvsroot/cpptool/CppParser/include/cpput/properties.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** properties.h 8 Jun 2004 20:23:21 -0000 1.1.1.1 --- properties.h 5 Aug 2004 20:52:45 -0000 1.2 *************** *** 4,12 **** # include <cpput/config.h> # include <cpput/enumerator.h> # include <map> ! # include <stdexcept> namespace CppUT { class CPPUT_API Properties --- 4,19 ---- # include <cpput/config.h> # include <cpput/enumerator.h> + # include <cpputtools/value.h> # include <map> ! ! ! // @todo thread-safety issue when using copy constructor with std::string... namespace CppUT { + using CppUTTools::ValueBadCast; + using CppUTTools::Value; + using CppUTTools::value; + class CPPUT_API Properties *************** *** 17,73 **** } ! Properties( const Property &property ) { - add( property ); } ! Properties &add( const Property &property ) { ! properties.erase( property.name() ); ! properties.insert( Map::value_type( property.name(), ! property.value() ) ); ! return *this; } ! Properties &set( const std::string &name, ! const std::string &value ) { ! return add( Property( name, value ) ); } Enumerator<std::string> names() const { ! return enumStlMapValues( properties ); } ! bool has( const std::string &name ) { ! return properties_.count( name ) > 0; } ! std::string get( const std::string &name ) const { ! Map::const_iterator it = properties_.find( name ); ! if ( it == properties_.end() ) ! throw std::invalid_argument( "No properties named " + name ); return it->second; } ! std::string tryGet( const std::string &name ) const { ! Map::const_iterator it = properties_.find( name ); ! if ( it == properties_.end() ) ! return ""; return it->second; } ! bool has( const std::string &name ) const { ! return properties_.count( name ) > 0; } private: ! typedef std::map<std::string,std::string> Map; ! Map properties_; }; --- 24,95 ---- } ! virtual ~Properties() { } ! void add( const Properties &other ) { ! ValuesByName::const_iterator it = other.valuesByName_.begin(); ! for ( ; it != other.valuesByName_.end(); ++it ) ! if ( valuesByName_.count( it->first ) == 0 ) ! valuesByName_[ it->first ] = it->second; } ! void replace( const Properties &other ) { ! ValuesByName::const_iterator it = other.valuesByName_.begin(); ! for ( ; it != other.valuesByName_.end(); ++it ) ! valuesByName_[ it->first ] = it->second; ! } ! ! void set( const std::string &name, ! const CppUTTools::Value &value ) ! { ! valuesByName_[ name ] = value; ! } ! ! void copy( const Properties &other, ! const std::string &name ) ! { ! set( name, other.get( name ) ); } Enumerator<std::string> names() const { ! return enumStlMapKeys( valuesByName_, Type<std::string>() ); } ! bool has( const std::string &name ) const { ! return valuesByName_.count( name ) > 0; } ! Value get( const std::string &name ) const { ! ValuesByName::const_iterator it = valuesByName_.find( name ); ! if ( it == valuesByName_.end() ) ! throw std::invalid_argument( "No properties named '" + name + "'." ); return it->second; } ! Value tryGet( const std::string &name, ! const CppUTTools::Value &defaultValue = CppUTTools::Value() ) const { ! ValuesByName::const_iterator it = valuesByName_.find( name ); ! if ( it == valuesByName_.end() ) ! return defaultValue; return it->second; } ! /* ! int getInt( const std::string &name ) const { ! return get<int>( get( name ) ); } + */ private: ! typedef std::map<std::string,CppUTTools::Value> ValuesByName; ! ValuesByName valuesByName_; }; *************** *** 77,80 **** ! ! #endif // CPPUT_PROPERTIES_H_INCLUDED \ No newline at end of file --- 99,101 ---- ! #endif // CPPUT_PROPERTIES_H_INCLUDED Index: testlistener.h =================================================================== RCS file: /cvsroot/cpptool/CppParser/include/cpput/testlistener.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** testlistener.h 8 Jun 2004 20:23:21 -0000 1.1.1.1 --- testlistener.h 5 Aug 2004 20:52:45 -0000 1.2 *************** *** 15,24 **** } ! virtual void testFailed( const TestFailure &failure, ! TestContext &context ) { } ! virtual void enterTest( Test &test, TestContext &context ) { } --- 15,24 ---- } ! virtual void enterTest( Test &test, TestContext &context ) { } ! virtual void processTestResult( TestResult &result, ! TestContext &context ) { } --- NEW FILE: testrunresult.h --- #ifndef CPPUT_TESTRUNRESULT_H_INCLUDED # define CPPUT_TESTRUNRESULT_H_INCLUDED # include <cpput/config.h> # include <cpput/forwards.h> # include <cpput/testlistener.h> # include <cpput/testresult.h> # include <deque> namespace CppUT { class CPPUT_API TestRunResult : public TestListener { public: int testCount() const { return int(results_.size()); } int successCount() const { return int(successes_.size()); } int failureCount() const { return int(failures_.size()); } const TestResult &testResultAt( int index ) const { #if CPPUT_HAS_VECTOR_AT return results_.at( index ); #else return results_[ index ]; #endif } const TestResult &failureAt( int index ) const { #if CPPUT_HAS_VECTOR_AT return results_.at( failures_.at(index) ); #else return results_[ failures_[index] ]; #endif } const TestResult &successAt( int index ) const { #if CPPUT_HAS_VECTOR_AT return results_.at( failures_.at(index) ); #else return results_[ failures_[index] ]; #endif } bool successful() const { return failures_.empty(); } // overridden from TestListener void processTestResult( TestResult &result, TestContext &context ) { if ( result.failed() ) failures_.push_back( results_.size() ); else successes_.push_back( results_.size() ); results_.push_back( result ); } private: typedef std::deque<TestResult> Results; Results results_; typedef std::deque<int> Failures; Failures failures_; typedef std::deque<int> Successes; Successes successes_; }; } // namespace CppUT #endif // CPPUT_TESTRUNRESULT_H_INCLUDED Index: testcontext.h =================================================================== RCS file: /cvsroot/cpptool/CppParser/include/cpput/testcontext.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** testcontext.h 8 Jun 2004 20:23:21 -0000 1.1.1.1 --- testcontext.h 5 Aug 2004 20:52:45 -0000 1.2 *************** *** 9,13 **** namespace CppUT { ! class CPPUT_API TestContext : private TestFailureHandler { public: --- 9,13 ---- namespace CppUT { ! class CPPUT_API TestContext : private TestExceptionHandler { public: *************** *** 24,28 **** void remove( TestListener &listener ); ! void appendGuard( const TestFailureGuardPtr &guard ); void removeGuard(); --- 24,28 ---- void remove( TestListener &listener ); ! void appendGuard( const TestExceptionGuardPtr &guard ); void removeGuard(); *************** *** 35,50 **** void (TestListener::*eventMethod)( AbstractTestSuite &, TestContext &) ) ; ! void dispatchTestFailure( const TestFailure &failure ); ! // overridden from TestFailureHandler ! void handleAssertion( Test &failedTest, const AssertException &e ); ! void handleFault( Test &failedTest, const FaultException &e ); private: ! TestFailureGuardChain guardsChain_; typedef std::vector<TestListener *> Listeners; Listeners listeners_; }; --- 35,52 ---- void (TestListener::*eventMethod)( AbstractTestSuite &, TestContext &) ) ; ! void dispatchTestResult( TestResult &result ); ! void dispatchTestSuccessResult( Test &test ); ! // overridden from TestExceptionHandler ! void handleResultException( Test &test, const ResultException &e ); private: ! TestExceptionGuardChain guardsChain_; typedef std::vector<TestListener *> Listeners; Listeners listeners_; + + bool testSucceeded_; }; Index: enumerator.h =================================================================== RCS file: /cvsroot/cpptool/CppParser/include/cpput/enumerator.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** enumerator.h 8 Jun 2004 20:23:20 -0000 1.1.1.1 --- enumerator.h 5 Aug 2004 20:52:45 -0000 1.2 *************** *** 591,595 **** ,typename EnumeratedType> Enumerator<CPPUT_DEDUCED_TYPENAME StlMapType::key_type> ! enumStlMapKeys( const StlMapType &map, Type<EnumeratedType>() ) { return enumStlMapKeysAdapt( map, ConversionEnumAdaptor<EnumeratedType>() ); --- 591,595 ---- ,typename EnumeratedType> Enumerator<CPPUT_DEDUCED_TYPENAME StlMapType::key_type> ! enumStlMapKeys( const StlMapType &map, Type<EnumeratedType> ) { return enumStlMapKeysAdapt( map, ConversionEnumAdaptor<EnumeratedType>() ); Index: message.h =================================================================== RCS file: /cvsroot/cpptool/CppParser/include/cpput/message.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** message.h 8 Jun 2004 20:23:20 -0000 1.1.1.1 --- message.h 5 Aug 2004 20:52:45 -0000 1.2 *************** *** 3,6 **** --- 3,7 ---- # include <cpput/config.h> + # include <cpput/properties.h> # include <string> # include <vector> *************** *** 88,92 **** --- 89,120 ---- } + Properties &properties() + { + return properties_; + } + + const Properties &properties() const + { + return properties_; + } + + void setStatus( bool succeeded ) + { + properties().set( "cpput.status", succeeded ); + } + + void setResultType( const std::string &resultType ) + { + properties().set( "cpput.result_type", resultType ); + } + + bool hasResultType() const + { + return properties().has( "cpput.result_type" ); + } + private: + Properties properties_; + typedef std::vector<std::string> Details; Details details_; --- NEW FILE: tablefixture.h --- #ifndef CPPUT_TABLEFIXTURE_H_INCLUDED # define CPPUT_TABLEFIXTURE_H_INCLUDED # include <cpput/testcase.h> # include <map> namespace CppUT { class CellBinder; class TableFixture; class TableRow; typedef SmartPtr<CellBinder> CellBinderPtr; class Table { public: virtual ~Table() { } }; class TableRow { public: TableRow( const Table &table, int rowIndex ); virtual ~TableRow() { } enum { invalidRow = -1 }; // invalidRow if it does not exist virtual int getCellIndex( const std::string &name ) = 0; virtual int cellCount() = 0; virtual bool isCellEmpty( int index ) = 0; virtual int cellAsInt( int index ) = 0; virtual unsigned int cellAsUnsignedInt( int index ) = 0; virtual char cellAsChar( int index ) = 0; virtual float cellAsFloat( int index ) = 0; virtual double cellAsDouble( int index ) = 0; virtual std::string cellAsString( double index ) = 0; }; class CellBinder { public: virtual ~CellBinder() { } virtual void bind( TableFixture &fixture, const TableRow &row, int cellIndex ) const = 0; }; template<class MemberType> class CommonCellBinder : public CellBinder { public: CommonCellBinder( MemberType TableFixture::*input, MemberType (TableRow::*cellGetter)() ) { } // overridden from CellBinder void bind( TableFixture &fixture, const TableRow &row, int cellIndex ) const { fixture->*input_ = (row->*cellGetter_)( cellIndex ); } private: MemberType TableFixture::*input_; MemberType (TableRow::*cellGetter_)(); }; class TableFixture : public AbstractTestCase { public: typedef void (TableFixture::*ActionFn)(); typedef char TableFixture::*CharInput; typedef int TableFixture::*IntInput; typedef unsigned int TableFixture::*UnsignedIntInput; typedef float TableFixture::*FloatInput; typedef double TableFixture::*DoubleInput; typedef std::string TableFixture::*StringInput; void bindAction( const std::string &actionName, ActionFn actionMethod ); void bindInput( const std::string &inputName, CharInput input ); void bindInput( const std::string &inputName, IntInput input ); void bindInput( const std::string &inputName, UnsignedIntInput input ); void bindInput( const std::string &inputName, FloatInput input ); void bindInput( const std::string &inputName, DoubleInput input ); void bindInput( const std::string &inputName, StringInput input ); void bindInput( const std::string &inputName, const CellBinderPtr &binder ); //void beginProcessTable( const Table &table ); //void endProcessTable( const Table &table ); virtual void beginProcessRow( const TableRow &row ); virtual void endProcessRow( const TableRow &row ); virtual void processRow( const TableRow &row ); private: typedef std::map< std::string, CellBinderPtr > Binders; Binders binders_; typedef std::map< std::string, Functor0 > Actions; Actions actions_; }; } // namespace CppUT #endif // CPPUT_TABLEFIXTURE_H_INCLUDED |