/[escript]/trunk/tools/CppUnitTest/inc/CppUnitTest/TestSuite.h
ViewVC logotype

Contents of /trunk/tools/CppUnitTest/inc/CppUnitTest/TestSuite.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 155 - (show annotations)
Wed Nov 9 02:02:19 2005 UTC (17 years, 4 months ago) by jgs
File MIME type: text/plain
File size: 1610 byte(s)
move all directories from trunk/esys2 into trunk and remove esys2

1
2 #ifndef CPPUNIT_TESTSUITE_H
3 #define CPPUNIT_TESTSUITE_H
4
5 #include <vector>
6 #include <string>
7
8 #include "CppUnitTest/Guards.h"
9 #include "CppUnitTest/Test.h"
10
11 #include "CppUnitTest/CppUnitTestNamespace.h"
12 BEGIN_NAMESPACE_CPPUNITTEST
13
14 class TestResult;
15
16 /*
17 * A TestSuite is a Composite of Tests.
18 * It runs a collection of test cases. Here is an example.
19 *
20 * TestSuite *suite= new TestSuite();
21 * suite->addTest(new TestCaller<MathTest> ("testAdd", testAdd));
22 * suite->addTest(new TestCaller<MathTest> ("testDivideByZero", testDivideByZero));
23 *
24 * Note that TestSuites assume lifetime
25 * control for any tests added to them.
26 *
27 * see Test and TestCaller
28 */
29
30
31 class TestSuite : public Test
32 {
33 REFERENCEOBJECT (TestSuite)
34
35 public:
36 TestSuite (std::string name = "");
37 ~TestSuite ();
38
39 void run (TestResult *result);
40 int countTestCases ();
41 void addTest (Test *test);
42 std::string toString ();
43
44 virtual void deleteContents ();
45
46 private:
47 std::vector<Test *> m_tests;
48 const std::string m_name;
49
50
51 };
52
53
54 // Default constructor
55 inline TestSuite::TestSuite (std::string name)
56 : m_name (name)
57 {}
58
59
60 // Destructor
61 inline TestSuite::~TestSuite ()
62 { deleteContents (); }
63
64
65 // Adds a test to the suite.
66 inline void TestSuite::addTest (Test *test)
67 { m_tests.push_back (test); }
68
69
70 // Returns a string representation of the test suite.
71 inline std::string TestSuite::toString ()
72 { return "suite " + m_name; }
73
74
75 END_NAMESPACE_CPPUNITTEST
76
77 #endif

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26