-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_tool.cpp
More file actions
30 lines (24 loc) · 737 Bytes
/
test_tool.cpp
File metadata and controls
30 lines (24 loc) · 737 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
#include "test_tool.h"
void runTest() {
std::vector<AssertFail> afList;
std::vector<bool> passList;
for (auto fun : RegisterTest::getFunList()) {
try {
fun();
passList.push_back(true);
} catch (const AssertFail& af) {
afList.push_back(af);
passList.push_back(false);
}
}
std::cerr << "all: " << RegisterTest::getFunList().size()
<< ", fail: " << afList.size()
<< ", pass: " << (RegisterTest::getFunList().size()-afList.size())
<< std::endl;
for (auto p : passList)
std::cerr << (p ? "." : "x");
std::cerr << std::endl;
for (auto af : afList)
std::cerr << af.what() << std::endl;
}
std::vector<std::function<void(void)>> RegisterTest::m_functionList{};