1 | // |
2 | // Test.h |
3 | // |
4 | |
5 | |
6 | #ifndef Poco_CppUnit_Test_INCLUDED |
7 | #define Poco_CppUnit_Test_INCLUDED |
8 | |
9 | |
10 | #include "Poco/CppUnit/CppUnit.h" |
11 | #include <string> |
12 | #include <vector> |
13 | |
14 | |
15 | namespace CppUnit { |
16 | |
17 | |
18 | class TestResult; |
19 | |
20 | |
21 | /* |
22 | * A Test can be run and collect its results. |
23 | * See TestResult. |
24 | * |
25 | */ |
26 | class CppUnit_API Test |
27 | { |
28 | public: |
29 | virtual ~Test() = 0; |
30 | virtual void run(TestResult* result) = 0; |
31 | virtual int countTestCases() = 0; |
32 | virtual std::string toString() = 0; |
33 | |
34 | void addSetup(const std::vector<std::string>& setup); |
35 | |
36 | protected: |
37 | std::vector<std::string> _setup; |
38 | }; |
39 | |
40 | |
41 | inline Test::~Test() |
42 | { |
43 | } |
44 | |
45 | |
46 | // Runs a test and collects its result in a TestResult instance. |
47 | inline void Test::run(TestResult* /*result*/) |
48 | { |
49 | } |
50 | |
51 | |
52 | // Counts the number of test cases that will be run by this test. |
53 | inline int Test::countTestCases() |
54 | { |
55 | return 0; |
56 | } |
57 | |
58 | |
59 | // Returns the name of the test instance. |
60 | inline std::string Test::toString() |
61 | { |
62 | return "" ; |
63 | } |
64 | |
65 | |
66 | inline void Test::addSetup(const std::vector<std::string>& setup) |
67 | { |
68 | _setup = setup; |
69 | } |
70 | |
71 | } // namespace CppUnit |
72 | |
73 | |
74 | #endif // Poco_CppUnit_Test_INCLUDED |
75 | |