58 lines
1.3 KiB
C++
58 lines
1.3 KiB
C++
#include <cstdlib>
|
|
#include <cstring>
|
|
#include <iostream>
|
|
|
|
void RunCoreTests();
|
|
void RunSerializationTests();
|
|
void RunPhysicsTests();
|
|
void RunAssetsTests();
|
|
void RunGraphicsTests();
|
|
void RunUiTests();
|
|
void RunGameplayTests();
|
|
void RunEditorTests();
|
|
void RunAudioTests();
|
|
void RunJobsTests();
|
|
void RunCookerTests();
|
|
|
|
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},
|
|
{"editor", RunEditorTests},
|
|
{"audio", RunAudioTests},
|
|
{"jobs", RunJobsTests},
|
|
{"cooker", RunCookerTests},
|
|
};
|
|
}
|
|
|
|
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;
|
|
}
|