initial commit
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include "test-cases.cpp"
|
||||
|
||||
typedef int (*TestFunc)(void);
|
||||
|
||||
void register_tests(void);
|
||||
|
||||
std::vector<TestFunc> test_funcs;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
static unsigned long fails = 0,
|
||||
successes = 0;
|
||||
|
||||
register_tests();
|
||||
|
||||
for (int i = 0, l = test_funcs.size(); i < l; i++) {
|
||||
std::cout << "--- Running test " << i + 1 << "/" << l << "\n";
|
||||
if (test_funcs[i]())
|
||||
{
|
||||
std::cout << "Test failed.\n";
|
||||
fails++;
|
||||
}
|
||||
else
|
||||
{
|
||||
successes++;
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "--- Finished testing: " << successes << " passed, " << fails << " failed\n";
|
||||
|
||||
return !!fails;
|
||||
}
|
||||
Reference in New Issue
Block a user