feat: split tests into per-suite files
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
void RunCoreTests();
|
||||
void RunSerializationTests();
|
||||
void RunPhysicsTests();
|
||||
void RunAssetsTests();
|
||||
void RunGraphicsTests();
|
||||
void RunUiTests();
|
||||
void RunGameplayTests();
|
||||
|
||||
namespace {
|
||||
struct Suite {
|
||||
const char* name;
|
||||
void (*run)();
|
||||
};
|
||||
|
||||
constexpr Suite suites[] = {
|
||||
{"core", RunCoreTests},
|
||||
{"serialization", RunSerializationTests},
|
||||
{"physics", RunPhysicsTests},
|
||||
{"assets", RunAssetsTests},
|
||||
{"graphics", RunGraphicsTests},
|
||||
{"ui", RunUiTests},
|
||||
{"gameplay", RunGameplayTests},
|
||||
};
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
const char* only = argc > 1 ? argv[1] : nullptr;
|
||||
bool ranAny = false;
|
||||
|
||||
for (const Suite& suite : suites) {
|
||||
if (only != nullptr && std::strcmp(only, suite.name) != 0) {
|
||||
continue;
|
||||
}
|
||||
suite.run();
|
||||
ranAny = true;
|
||||
std::cout << suite.name << " tests passed\n";
|
||||
}
|
||||
|
||||
if (!ranAny) {
|
||||
std::cerr << "unknown test suite: " << only << '\n';
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user