[Cppunit-cvs] cppunit2/include/opentest config.h,NONE,1.1 forwards.h,NONE,1.1 properties.h,NONE,1.1
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2004-11-15 08:33:39
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1703 Added Files: config.h forwards.h properties.h resourcelist.h testplan.h testrunner.h Log Message: * initial implementation of the TestRunner interface --- NEW FILE: resourcelist.h --- #ifndef OPENTEST_RESOURCELIST_H_INCLUDED # define OPENTEST_RESOURCELIST_H_INCLUDED # include <opentest/config.h> # include <string> namespace OpenTest { class OPENTEST_API ResourceList { public: ResourceList(); ResourceList( const std::string &name ); ResourceList &add( const std::string &name ); unsigned int count() const; std::string at( unsigned int index ) const; private: std::deque<std::string> resources_; }; // inline implementation of ResourceList // ////////////////////////////////////////////////////////////////// inline ResourceList::ResourceList() { } inline ResourceList::ResourceList( const std::string &name ) { add( name ); } inline ResourceList & ResourceList::add( const std::string &name ) { resources_.push_back( name ); return *this; } inline unsigned int ResourceList::count() const { return resources_.size(); } inline std::string ResourceList::at( unsigned int index ) const { return resources_.at( index ); } } // namespace OpenTest #endif // OPENTEST_RESOURCELIST_H_INCLUDED --- NEW FILE: config.h --- #ifndef OPENTEST_CONFIG_H_INCLUDED # define OPENTEST_CONFIG_H_INCLUDED # include <cpptl/config.h> /// @todo add autolink stuff here # define OPENTEST_API #endif // OPENTEST_CONFIG_H_INCLUDED --- NEW FILE: testrunner.h --- #ifndef OPENTEST_TESTRUNNER_H_INCLUDED # define OPENTEST_TESTRUNNER_H_INCLUDED # include <opentest/forwards.h> namespace OpenTest { class OPENTEST_API TestRunner { public: virtual ~TestRunner() { } virtual void declareTests( TestDeclarator &declarator ) = 0; // Notes: test plan must never contains suite [? do we want this constraint?]. // => may be the test runner should indicates if it supports running suite ? // => would make the TestRunTracker interface much more complex though... // => Move 'configuration' in TestPlan ? virtual void runTests( const TestPlan &testPlan, TestRunTracker &tracker, const Properties &configuration ) = 0; }; class OPENTEST_API TestDeclarator { public: virtual ~TestDeclarator() { } virtual TestId beginSuite( const std::string &name, const Properties &data ) = 0; virtual TestId addTest( const std::string &name, const Properties &data ) = 0; virtual void addSuite( TestId suite ) = 0; virtual void endSuite() = 0; }; class OPENTEST_API TestRunTracker { public: virtual ~TestRunTracker() { } virtual void startTestRun() = 0; virtual void startTest( const TestPlanEntry &testEntry ) = 0; virtual void addTestInfo( const TestPlanEntry &testEntry, const Properties &data ) = 0; virtual void endTest( const TestPlanEntry &testEntry ) = 0; virtual void endTestRun() = 0; virtual bool shouldStopTestRun() = 0; virtual void aqcuireResources( const ResourceList &resources ) = 0; virtual void releaseResources( const ResourceList &resources ) = 0; }; } // namespace OpenTest #endif // OPENTEST_TESTRUNNER_H_INCLUDED --- NEW FILE: properties.h --- #ifndef OPENTEST_PROPERTIES_H_INCLUDED # define OPENTEST_PROPERTIES_H_INCLUDED # include <opentest/config.h> # include <cpptl/enumerator.h> # include <exception> # include <deque> # include <vector> # include <string.h> namespace OpenTest { /// @todo For thread-safety, std::string need to be replaced with an implementation /// that guaranty that the copy constructor is thread-safe. class OPENTEST_API ValueBadCast : public std::bad_cast { public: ValueBadCast() [...1141 lines suppressed...] } inline Properties::PropertyList::const_iterator Properties::find( const std::string &name ) const { PropertyList::const_iterator it = properties_.begin(); PropertyList::const_iterator itEnd = properties_.end(); for ( ; it != itEnd; ++it ) if ( it->name() == name ) return it; return itEnd; } } // namespace OpenTest #endif // OPENTEST_PROPERTIES_H_INCLUDED --- NEW FILE: testplan.h --- #ifndef OPENTEST_TESTPLAN_H_INCLUDED # define OPENTEST_TESTPLAN_H_INCLUDED # include <opentest/forwards.h> # include <opentest/properties.h> # include <cpptl/enumerator.h> namespace OpenTest { typedef unsigned int TestPlanEntryId; class OPENTEST_API TestPlan { public: virtual ~TestPlan() { } virtual TestPlanEntryPtrEnum entries() const = 0; }; class OPENTEST_API TestPlanEntry { public: virtual ~TestPlanEntry() { } virtual TestPlanEntryId id() const = 0; /// Test to run virtual TestId test() const = 0; /// Used to pass configuration data to the test runner or the test itself virtual const Properties &configuration() const = 0; }; } // namespace OpenTest #endif // OPENTEST_TESTPLAN_H_INCLUDED --- NEW FILE: forwards.h --- #ifndef OPENTEST_FORWARDS_H_INCLUDED # define OPENTEST_FORWARDS_H_INCLUDED # include <opentest/config.h> # include <cpptl/enumerator.h> # include <cpptl/sharedptr.h> namespace OpenTest { class ConstPropertiesAccessor; class Property; class Properties; class ResourceList; class TestDeclarator; class TestPlan; class TestPlanEntry; class TestRunTracker; class Value; class ValueBadCast; typedef CppTL::SharedPtr<TestPlanEntry> TestPlanEntryPtr; typedef CppTL::AnyEnumerator<TestPlanEntryPtr> TestPlanEntryPtrEnum; typedef unsigned int TestId; } // namespace OpenTest #endif // OPENTEST_FORWARDS_H_INCLUDED |