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

Contents of /trunk/tools/CppUnitTest/src/Test.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3150 - (show annotations)
Fri Sep 3 05:40:27 2010 UTC (9 years, 4 months ago) by caltinay
File MIME type: text/plain
File size: 4307 byte(s)
Removed executable prop from non-executables.

1 //
2 // Permission to reproduce and create derivative works from the Software ("Software Derivative Works")
3 // is hereby granted to you under the copyright of Michael Feathers. Michael Feathers also grants you
4 // the right to distribute the Software and Software Derivative Works.
5 //
6 // Michael Feathers licenses the Software to you on an "AS IS" basis, without warranty of any kind.
7 // Michael Feathers HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES OR CONDITIONS, EITHER EXPRESS OR IMPLIED,
8 // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OR CONDITIONS OF MERCHANTABILITY, NON INFRINGEMENT
9 // AND FITNESS FOR A PARTICULAR PURPOSE.  You are solely responsible for determining the appropriateness
10 // of using the Software and assume all risks associated with the use and distribution of this Software,
11 // including but not limited to the risks of program errors, damage to or loss of data, programs or
12 // equipment, and unavailability or interruption of operations.  MICHAEL FEATHERS WILL NOT BE
13 // LIABLE FOR ANY DIRECT DAMAGES OR FOR ANY SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC
14 // CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF MICHAEL FEATHERS HAD BEEN ADVISED
15 // OF THE POSSIBILITY OF SUCH DAMAGE.  Michael Feathers will not be liable for the loss of, or damage
16 // to, your records or data, or any damages claimed by you based on a third party claim.
17 //
18 // You agree to distribute the Software and any Software Derivatives under a license agreement that:
19 //
20 // 1) is sufficient to notify all licensees of the Software and Software Derivatives that Michael
21 // Feathers assumes no liability for any claim that may arise regarding the Software or
22 // Software Derivatives, and
23 // 2) that disclaims all warranties, both express and implied, from Michael Feathers regarding the
24 // Software and Software Derivatives.  (If you include this Agreement with any distribution
25 // of the Software and Software Derivatives you will have meet this requirement) You agree that
26 // you will not delete any copyright notices in the Software.
27 //
28 // This Agreement is the exclusive statement of your rights in the Software as provided by Michael
29 // Feathers. Except for the licenses granted to you in the second paragraph above, no other licenses
30 // are granted hereunder, by estoppel, implication or otherwise.
31 //
32 #ifndef CPPUNIT_TEST_H
33 #define CPPUNIT_TEST_H
34
35 #include <string>
36 #include <vector>
37 #include "CppUnitTestNamespace.h"
38
39 BEGIN_NAMESPACE_CPPUNITTEST
40
41 class TestResult;
42
43 /*
44 * A Test can be run and collect its results.
45 * See TestResult.
46 *
47 */
48
49 class Test
50 {
51 public:
52 Test(std::string name):testName(name) {testStatus=true;};
53 Test():testName("") {testStatus=true;};
54 virtual ~Test () ;
55
56 virtual void run (TestResult *result) = 0;
57 virtual int countTestCases () = 0;
58 virtual std::string toString() = 0;
59 virtual std::string name();
60 virtual void setArgs(const std::vector<std::string>& args);
61 virtual void setFailure() {testStatus=false;}
62 virtual bool hasFailure() {return (!testStatus);}
63 virtual const std::vector<std::string>& getArgs();
64
65 private:
66 //
67 // the name of the test
68 std::string testName;
69 std::vector<std::string> testArgs;
70
71 // indicates if this test or any of its contained tests have failed
72 // if testStatus is true all tests are good, otherwise some test has failed
73 bool testStatus;
74 };
75
76 inline Test::~Test ()
77 {}
78
79
80
81 // Runs a test and collects its result in a TestResult instance.
82 inline void Test::run (TestResult *result)
83 {}
84
85
86 // Counts the number of test cases that will be run by this test.
87 inline int Test::countTestCases ()
88 { return 0; }
89
90
91 // Returns the name of the test instance.
92 inline std::string Test::toString ()
93 { return ""; }
94
95 //
96 // Return the name of the test
97 inline std::string Test::name() {
98 return testName;
99 }
100
101 //
102 // set the argument list
103 inline void Test::setArgs(const std::vector<std::string>& args) {
104 //
105 // copy the arguments
106 //
107 testArgs = args;
108 }
109
110 //
111 // get the argument list
112 inline const std::vector<std::string>& Test::getArgs() {
113 return(testArgs);
114 }
115
116
117 END_NAMESPACE_CPPUNITTEST
118
119 #endif
120

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26