From 004ee3aafb6beb4e984877186bced560010f4ddb Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Fri, 22 Nov 2024 21:57:08 +0100 Subject: fix RenderSystem unit test path resolution + reset Config before each test --- src/test/main.cpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'src/test/main.cpp') diff --git a/src/test/main.cpp b/src/test/main.cpp index 241015d..e03a989 100644 --- a/src/test/main.cpp +++ b/src/test/main.cpp @@ -1,15 +1,31 @@ -#include - #include +#define protected public +#define private public + +#include + using namespace crepe; using namespace testing; +class GlobalConfigReset : public EmptyTestEventListener { +public: + Config & cfg = Config::get_instance(); + Config cfg_default = Config(); + + // This function is called before each test + void OnTestStart(const TestInfo &) override { + cfg = cfg_default; + cfg.log.level = Log::Level::WARNING; + } +}; + int main(int argc, char ** argv) { InitGoogleTest(&argc, argv); - auto & cfg = Config::get_instance(); - cfg.log.level = Log::Level::ERROR; + UnitTest & ut = *UnitTest::GetInstance(); + ut.listeners().Append(new GlobalConfigReset); return RUN_ALL_TESTS(); } + -- cgit v1.2.3