36 lines
598 B
C++
36 lines
598 B
C++
#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;
|
|
}
|