diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-22 21:57:08 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-22 21:57:08 +0100 |
commit | 004ee3aafb6beb4e984877186bced560010f4ddb (patch) | |
tree | 9f6f79dd0a2c50e35bcc7bd5d76b0e41a20af7a7 /src/test/main.cpp | |
parent | 1499363d85abedbdb571e33801b821f4dfabc638 (diff) |
fix RenderSystem unit test path resolution + reset Config before each testloek/hotfix
Diffstat (limited to 'src/test/main.cpp')
-rw-r--r-- | src/test/main.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
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 <crepe/api/Config.h> - #include <gtest/gtest.h> +#define protected public +#define private public + +#include <crepe/api/Config.h> + 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(); } + |