-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestCase.h
More file actions
54 lines (38 loc) · 1.06 KB
/
TestCase.h
File metadata and controls
54 lines (38 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef __TESTCASE_H__
#define __TESTCASE_H__
#include <string>
#include <vector>
#include "StdOutTestReporter.h"
using namespace std;
class TestCase;
typedef vector<TestCase*> TestSuite;
//*******************************************************************
// Exception used within asserts to identify a test as failing
class TestFail
{
public:
TestFail(string str) : m_msg(str) {};
TestFail() {};
~TestFail() {};
string m_msg;
};
//*******************************************************************
// Base class for all test cases
class TestCase
{
public:
TestCase(string name);
virtual ~TestCase(void);
virtual void run() = 0;
virtual void setUp();
virtual void tearDown();
string getTestName();
void registerTestReporter(TestReporter* reporter);
protected:
void assertTrue(bool val) throw (TestFail);
void assertTrue(string msg, bool val) throw (TestFail);
TestReporter* m_reporter;
StdOutTestReporter m_defaultReporter;
string m_name;
};
#endif