From 0e276c49adc1ef38993f1a90b0f87c732331598c Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sun, 9 Mar 2025 18:14:24 +0530 Subject: Add test registry macro to allow managing multiple specs --- spec/TestUtils.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 spec/TestUtils.cpp (limited to 'spec/TestUtils.cpp') diff --git a/spec/TestUtils.cpp b/spec/TestUtils.cpp new file mode 100644 index 0000000..e496a9b --- /dev/null +++ b/spec/TestUtils.cpp @@ -0,0 +1,20 @@ +#include +#include +#include + +std::vector> &getQTestRegistry() { + static std::vector> registry; + return registry; +} + +int runAllTests() { + int exitCode = 0; + for (const auto &runTest : getQTestRegistry()) { + auto test = runTest(); + // printf(":::: %s\n", test->objectName().toStdString().c_str()); + exitCode |= QTest::qExec(test); + delete test; + } + getQTestRegistry().clear(); + return exitCode; +} -- cgit v1.3.1