-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestset.cpp
More file actions
48 lines (34 loc) · 863 Bytes
/
testset.cpp
File metadata and controls
48 lines (34 loc) · 863 Bytes
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
#include "testset.h"
#include <iostream>
#include "testbase.h"
unit::TestSet::TestSet(const std::string &name)
: name(name), maxNameLength(0) {
}
void unit::TestSet::addTest(unit::ITest *test) {
maxNameLength = std::max(maxNameLength, (int)test->getName().length());
TestCollection::addTest(test);
}
std::string unit::TestSet::getName() {
return name;
}
void unit::TestSet::run() {
std::cout << "Testing " << name << "\n";
for (ITest *test : *this) {
preTest();
test->run();
postTest();
if (dynamic_cast<TestBase *>(test))
((TestBase *)test)->align(maxNameLength);
test->report();
}
std::cout << "\n";
}
void unit::TestSet::report() {
}
void unit::TestSet::preTest() {
}
void unit::TestSet::postTest() {
}
void unit::TestSet::fail() {
throw std::exception();
}