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

Contents of /trunk/tools/CppUnitTest/inc/CppUnitTest/Test.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: 1912 byte(s)
move all directories from trunk/esys2 into trunk and remove esys2

1
2 #ifndef CPPUNIT_TEST_H
3 #define CPPUNIT_TEST_H
4
5 #include <string>
6 #include <vector>
7
8 #include "CppUnitTest/CppUnitTestNamespace.h"
9 BEGIN_NAMESPACE_CPPUNITTEST
10
11 class TestResult;
12
13 /*
14 * A Test can be run and collect its results.
15 * See TestResult.
16 *
17 */
18
19 class Test
20 {
21 public:
22 Test(std::string name):testName(name) {testStatus=true;};
23 Test():testName("") {testStatus=true;};
24 virtual ~Test () ;
25
26 virtual void run (TestResult *result) = 0;
27 virtual int countTestCases () = 0;
28 virtual std::string toString() = 0;
29 virtual std::string name();
30 virtual void setArgs(const std::vector<std::string>& args);
31 virtual void setFailure() {testStatus=false;}
32 virtual bool hasFailure() {return (!testStatus);}
33 virtual const std::vector<std::string>& getArgs();
34
35 private:
36 //
37 // the name of the test
38 std::string testName;
39 std::vector<std::string> testArgs;
40
41 // indicates if this test or any of its contained tests have failed
42 // if testStatus is true all tests are good, otherwise some test has failed
43 bool testStatus;
44 };
45
46 inline Test::~Test ()
47 {}
48
49
50
51 // Runs a test and collects its result in a TestResult instance.
52 inline void Test::run (TestResult *result)
53 {}
54
55
56 // Counts the number of test cases that will be run by this test.
57 inline int Test::countTestCases ()
58 { return 0; }
59
60
61 // Returns the name of the test instance.
62 inline std::string Test::toString ()
63 { return ""; }
64
65 //
66 // Return the name of the test
67 inline std::string Test::name() {
68 return testName;
69 }
70
71 //
72 // set the argument list
73 inline void Test::setArgs(const std::vector<std::string>& args) {
74 //
75 // copy the arguments
76 //
77 testArgs = args;
78 }
79
80 //
81 // get the argument list
82 inline const std::vector<std::string>& Test::getArgs() {
83 return(testArgs);
84 }
85
86
87 END_NAMESPACE_CPPUNITTEST
88
89 #endif
90

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26