refactor: make test a header
This commit is contained in:
parent
e58bdb01ba
commit
92c39f13a6
1 changed files with 13 additions and 2 deletions
|
|
@ -1,4 +1,6 @@
|
||||||
#include <iostream>
|
#ifndef RENDO_TEST_HPP
|
||||||
|
#define RENDO_TEST_HPP
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
@ -12,7 +14,6 @@ class Test {
|
||||||
bool evaluate();
|
bool evaluate();
|
||||||
};
|
};
|
||||||
|
|
||||||
bool Test::evaluate() { return complete(); }
|
|
||||||
|
|
||||||
class TestSuite {
|
class TestSuite {
|
||||||
private:
|
private:
|
||||||
|
|
@ -30,6 +31,12 @@ class TestSuite {
|
||||||
TestSuite& custom(std::string, std::function<bool()>);
|
TestSuite& custom(std::string, std::function<bool()>);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef RENDO_TEST_IMPLEMENTATION
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
bool Test::evaluate() { return complete(); }
|
||||||
|
|
||||||
TestSuite::TestSuite(std::string name): suite_name(name) {
|
TestSuite::TestSuite(std::string name): suite_name(name) {
|
||||||
tests = {};
|
tests = {};
|
||||||
}
|
}
|
||||||
|
|
@ -68,3 +75,7 @@ void TestSuite::run() {
|
||||||
std::cout << "Tests completed: " << completed << "/" << amount << (completed == amount ? ". Well done!" : "... You've got a job to do") << std::endl;
|
std::cout << "Tests completed: " << completed << "/" << amount << (completed == amount ? ". Well done!" : "... You've got a job to do") << std::endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Add table
Add a link
Reference in a new issue