From 61f99089288138989cf244d174882aa5088b738b Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sun, 9 Mar 2025 19:47:50 +0530 Subject: Refactor directory structure --- spec/BrowserManagerSpec.cpp | 4 ++-- spec/CommandInputSpec.cpp | 4 ++-- spec/TestUtils.cpp | 20 -------------------- spec/TestUtils.h | 40 ---------------------------------------- spec/main.cpp | 2 +- spec/testUtils.cpp | 20 ++++++++++++++++++++ spec/testUtils.h | 40 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 65 insertions(+), 65 deletions(-) delete mode 100644 spec/TestUtils.cpp delete mode 100644 spec/TestUtils.h create mode 100644 spec/testUtils.cpp create mode 100644 spec/testUtils.h (limited to 'spec') diff --git a/spec/BrowserManagerSpec.cpp b/spec/BrowserManagerSpec.cpp index f4af481..efa1ca3 100644 --- a/spec/BrowserManagerSpec.cpp +++ b/spec/BrowserManagerSpec.cpp @@ -2,8 +2,8 @@ #include #include -#include "BrowserManager.hpp" -#include "TestUtils.h" +#include "testUtils.h" +#include "widgets/BrowserManager.hpp" class BrowserManagerSpec : public QObject { Q_OBJECT diff --git a/spec/CommandInputSpec.cpp b/spec/CommandInputSpec.cpp index 5636a63..e687f70 100644 --- a/spec/CommandInputSpec.cpp +++ b/spec/CommandInputSpec.cpp @@ -1,6 +1,6 @@ -#include "TestUtils.h" +#include "testUtils.h" -#include "CommandInput.hpp" +#include "widgets/CommandInput.hpp" class CommandInputSpec : public QObject { Q_OBJECT diff --git a/spec/TestUtils.cpp b/spec/TestUtils.cpp deleted file mode 100644 index e496a9b..0000000 --- a/spec/TestUtils.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#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; -} diff --git a/spec/TestUtils.h b/spec/TestUtils.h deleted file mode 100644 index 20b3ba8..0000000 --- a/spec/TestUtils.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -#include -#include -#include - -#define ANSI_BOLD "\x1b[1m" -#define COLOR_CONTEXT "\x1b[32m" ANSI_BOLD -#define COLOR_IT "\x1b[36m" ANSI_BOLD -#define COLOR_SKIP "\x1b[33m" ANSI_BOLD -#define ANSI_RESET "\x1b[0m" - -#define context(msg) printf("⚪" COLOR_CONTEXT "%s" ANSI_RESET "\n", msg); - -#define it(msg) \ - printf(" ⚪" ANSI_BOLD COLOR_IT "it " ANSI_RESET COLOR_IT "%s" ANSI_RESET \ - "\n", \ - msg); \ - if (1) - -#define xit(msg) \ - printf(" ⚪" COLOR_SKIP "SKIPPED it %s" ANSI_RESET "\n", msg); \ - if (0) - -#define STRINGIFY(x) #x - -std::vector> &getQTestRegistry(); -int runAllTests(); - -#define QTEST_REGISTER(klass) \ - namespace { \ - const bool registered__##klass = []() { \ - getQTestRegistry().push_back([]() { \ - auto t = new klass; \ - t->setObjectName(#klass); \ - return t; \ - }); \ - return true; \ - }(); \ - }; diff --git a/spec/main.cpp b/spec/main.cpp index c085886..352ecba 100644 --- a/spec/main.cpp +++ b/spec/main.cpp @@ -1,4 +1,4 @@ -#include "TestUtils.h" +#include "testUtils.h" #include int main(int argc, char **argv) { 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; +} diff --git a/spec/testUtils.h b/spec/testUtils.h new file mode 100644 index 0000000..20b3ba8 --- /dev/null +++ b/spec/testUtils.h @@ -0,0 +1,40 @@ +#pragma once + +#include +#include +#include + +#define ANSI_BOLD "\x1b[1m" +#define COLOR_CONTEXT "\x1b[32m" ANSI_BOLD +#define COLOR_IT "\x1b[36m" ANSI_BOLD +#define COLOR_SKIP "\x1b[33m" ANSI_BOLD +#define ANSI_RESET "\x1b[0m" + +#define context(msg) printf("⚪" COLOR_CONTEXT "%s" ANSI_RESET "\n", msg); + +#define it(msg) \ + printf(" ⚪" ANSI_BOLD COLOR_IT "it " ANSI_RESET COLOR_IT "%s" ANSI_RESET \ + "\n", \ + msg); \ + if (1) + +#define xit(msg) \ + printf(" ⚪" COLOR_SKIP "SKIPPED it %s" ANSI_RESET "\n", msg); \ + if (0) + +#define STRINGIFY(x) #x + +std::vector> &getQTestRegistry(); +int runAllTests(); + +#define QTEST_REGISTER(klass) \ + namespace { \ + const bool registered__##klass = []() { \ + getQTestRegistry().push_back([]() { \ + auto t = new klass; \ + t->setObjectName(#klass); \ + return t; \ + }); \ + return true; \ + }(); \ + }; -- cgit v1.3.1