1 #ifndef __cxxtest__Descriptions_h__
2 #define __cxxtest__Descriptions_h__
4 //
5 // TestDescription, SuiteDescription and WorldDescription
6 // hold information about tests so they can be run and reported.
7 //
9 #include <cxxtest/LinkedList.h>
11 namespace CxxTest
12 {
13 class TestSuite;
15 class TestDescription : public Link
16 {
17 public:
18 virtual ~TestDescription();
20 virtual const char *file() const = 0;
21 virtual unsigned line() const = 0;
22 virtual const char *testName() const = 0;
23 virtual const char *suiteName() const = 0;
25 virtual void run() = 0;
27 virtual const TestDescription *next() const = 0;
28 virtual TestDescription *next() = 0;
29 };
31 class SuiteDescription : public Link
32 {
33 public:
34 virtual ~SuiteDescription();
36 virtual const char *file() const = 0;
37 virtual unsigned line() const = 0;
38 virtual const char *suiteName() const = 0;
39 virtual TestSuite *suite() const = 0;
41 virtual unsigned numTests() const = 0;
42 virtual const TestDescription &testDescription( unsigned /*i*/ ) const = 0;
44 virtual TestDescription *firstTest() = 0;
45 virtual const TestDescription *firstTest() const = 0;
46 virtual SuiteDescription *next() = 0;
47 virtual const SuiteDescription *next() const = 0;
49 virtual void activateAllTests() = 0;
50 virtual bool leaveOnly( const char * /*testName*/ ) = 0;
51 };
53 class WorldDescription : public Link
54 {
55 public:
56 virtual ~WorldDescription();
58 virtual unsigned numSuites( void ) const = 0;
59 virtual unsigned numTotalTests( void ) const = 0;
60 virtual const SuiteDescription &suiteDescription( unsigned /*i*/ ) const = 0;
62 enum { MAX_STRLEN_TOTAL_TESTS = 32 };
63 char *strTotalTests( char * /*buffer*/ ) const;
65 virtual SuiteDescription *firstSuite() = 0;
66 virtual const SuiteDescription *firstSuite() const = 0;
68 virtual void activateAllTests() = 0;
69 virtual bool leaveOnly( const char * /*suiteName*/, const char * /*testName*/ = 0 ) = 0;
70 };
71 }
73 #endif // __cxxtest__Descriptions_h__