forked from kth-competitive-programming/kactl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnitTestManager.h
53 lines (40 loc) · 1.02 KB
/
UnitTestManager.h
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
#pragma once
class UnitTest;
class UnitTestWrapper;
class UnitTestManager
{
friend class UnitTest;
friend class UnitTestWrapper;
private:
UnitTestManager();
~UnitTestManager();
public:
// Retrieves singleton instance.
static UnitTestManager* getInstance();
protected:
// Reports a "check" failure.
void reportCheckFailure(const string& have,
const string& want,
const string& message = "");
// Reports a failure.
void reportFailure(const string& message = "");
protected:
// Registers a test wrapper.
void registerWrapper(UnitTestWrapper* unitTestWrapper);
public:
// Runs all tests.
void runAll();
// Runs a specific test.
void runTest(const string& name);
// Print statistics.
void printStatistics() const;
private:
// Runs a specific test.
void runTest(UnitTestWrapper* unitTestWrapper);
private:
// Maps test names to test wrapper objects.
map<string, UnitTestWrapper*> m_unitTestWrappers;
// Statistics.
int m_successCount;
int m_failureCount;
};