forked from projectM-visualizer/projectm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestRunner.hpp
48 lines (38 loc) · 902 Bytes
/
TestRunner.hpp
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
//
// Created by matthew on 1/7/19.
//
// This is a place to collect/run non-graphical unit tests
// CONSIDER using some framework like googletest etc, but for now didn't want new dependencies
//
#ifndef PROJECTM_LUA_TESTRUNNER_H
#define PROJECTM_LUA_TESTRUNNER_H
#include <string>
#include <vector>
class Test
{
public:
const std::string getName() { return name; };
#ifdef NDEBUG
virtual bool test() {return true;}
#else
virtual bool test() = 0;
#endif
virtual ~Test() = default;
protected:
explicit Test(std::string name_) : name(name_) {};
const std::string name;
bool verify(const char *test, bool success)
{
if (!success)
std::cout << "failed " << test << std::endl;
return success;
}
};
class TestRunner
{
public:
static bool run();
private:
static std::vector<Test *> tests;
};
#endif //PROJECTM_LUA_TESTRUNNER_H