aboutsummaryrefslogtreecommitdiff
path: root/src/test/ScriptSaveManagerTest.cpp
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-11 14:21:34 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-11 14:21:34 +0100
commite6a5bb579d0969245f34119ef2489f47039c523e (patch)
treee8b0b922cd28d6f83d7bf59ea1b69bbb84d0fd04 /src/test/ScriptSaveManagerTest.cpp
parent7b8de90699aea153e73b5f2cee05c69b966b81be (diff)
parent78c4a8772526f40c531b5402b56932b0a41e22e8 (diff)
Merge branch 'master' into niels/remove_singleton
Diffstat (limited to 'src/test/ScriptSaveManagerTest.cpp')
-rw-r--r--src/test/ScriptSaveManagerTest.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/test/ScriptSaveManagerTest.cpp b/src/test/ScriptSaveManagerTest.cpp
new file mode 100644
index 0000000..64403c4
--- /dev/null
+++ b/src/test/ScriptSaveManagerTest.cpp
@@ -0,0 +1,35 @@
+#include <gtest/gtest.h>
+
+// stupid hack to allow access to private/protected members under test
+#define private public
+#define protected public
+
+#include <crepe/facade/DB.h>
+#include <crepe/manager/SaveManager.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);
+}