forked from projectM-visualizer/projectm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestRunner.cpp
44 lines (39 loc) · 1.25 KB
/
TestRunner.cpp
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
//
// Created by matthew on 1/7/19.
//
#include <iostream>
#include <MilkdropPresetFactory/Parser.hpp>
#include <TestRunner.hpp>
#include <MilkdropPresetFactory/Param.hpp>
std::vector<Test *> TestRunner::tests;
bool TestRunner::run()
{
if (tests.empty())
{
// We still call register/run tests in NDEBUG (useful for performance testing)
// but tests may choose to comment out body to save space
tests.push_back(Param::test());
tests.push_back(Parser::test());
tests.push_back(Expr::test());
tests.push_back(PCM::test());
}
int count = 0;
bool successful = true;
for (auto it=tests.begin() ; it < tests.end() ; it++ )
{
if (nullptr == (*it))
continue;
count++;
std::cout << "TestRunner: " << (*it)->getName() << " started" << std::endl;
std::cout.flush();
bool result = (*it)->test();
successful &= result;
if (result)
std::cout << "TestRunner: " << (*it)->getName() << " passed" << std::endl;
else
std::cout << "TestRunner: " << (*it)->getName() << " FAILED" << std::endl;
}
if (0 == count)
std::cout << "TestRunner: no tests found to run" << std::endl;
return successful;
}