diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-07 16:01:19 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-07 16:01:19 +0100 |
commit | 2e6fcb1d048edd13a2ec69ddd226fc8ebabc2389 (patch) | |
tree | 249b4633d24339467de9d0d008dce602a9cbd2cc /src/test/ScriptSaveManagerTest.cpp | |
parent | f19f37ae3eff84161f86e62a26fbd8b68f8f91a9 (diff) |
add SaveManager to Script
Diffstat (limited to 'src/test/ScriptSaveManagerTest.cpp')
-rw-r--r-- | src/test/ScriptSaveManagerTest.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/test/ScriptSaveManagerTest.cpp b/src/test/ScriptSaveManagerTest.cpp new file mode 100644 index 0000000..098afa0 --- /dev/null +++ b/src/test/ScriptSaveManagerTest.cpp @@ -0,0 +1,36 @@ +#include <gtest/gtest.h> + +// stupid hack to allow access to private/protected members under test +#define private public +#define protected public + +#include <crepe/manager/SaveManager.h> +#include <crepe/facade/DB.h> + +#include "ScriptTest.h" + +using namespace std; +using namespace crepe; +using namespace testing; + +class ScriptSaveManagerTest : public ScriptTest { +public: + class TestSaveManager : public SaveManager { + using SaveManager::SaveManager; + + // in-memory database for testing + DB db{}; + virtual DB & get_db() override { return this->db; } + }; + + TestSaveManager save_mgr{mediator}; +}; + +TEST_F(ScriptSaveManagerTest, GetSaveManager) { + MyScript & script = this->script; + + SaveManager & mgr = script.get_save_manager(); + + EXPECT_EQ(&mgr, &save_mgr); +} + |