aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-12-18 14:01:04 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-12-18 14:01:04 +0100
commit8afdca56d61a6c66ad1ac1bbd092192eeb827173 (patch)
tree356e1642fb150720b42c5a9f52c4e897d514a69c /src/test
parent40d64aa8f836087fd9a1af51e257533194bf2d80 (diff)
parent0e800c6857122436e7a766c6934991aa1d8d31ff (diff)
Merge branch 'master' into loek/scripts
Diffstat (limited to 'src/test')
-rw-r--r--src/test/DBTest.cpp8
-rw-r--r--src/test/SaveManagerTest.cpp17
-rw-r--r--src/test/main.cpp3
3 files changed, 24 insertions, 4 deletions
diff --git a/src/test/DBTest.cpp b/src/test/DBTest.cpp
index 99dedff..7f2c339 100644
--- a/src/test/DBTest.cpp
+++ b/src/test/DBTest.cpp
@@ -27,3 +27,11 @@ TEST_F(DBTest, Has) {
db.set("foo", "bar");
EXPECT_EQ(db.has("foo"), true);
}
+
+TEST_F(DBTest, MultipleKeys) {
+ db.set("foo", "foo");
+ db.set("bar", "bar");
+
+ EXPECT_EQ(db.get("foo"), "foo");
+ EXPECT_EQ(db.get("bar"), "bar");
+}
diff --git a/src/test/SaveManagerTest.cpp b/src/test/SaveManagerTest.cpp
index e9b0c29..7609e69 100644
--- a/src/test/SaveManagerTest.cpp
+++ b/src/test/SaveManagerTest.cpp
@@ -27,8 +27,8 @@ TEST_F(SaveManagerTest, ReadWrite) {
mgr.set<string>("foo", "bar");
ASSERT_TRUE(mgr.has("foo"));
- ValueBroker value = mgr.get<string>("foo");
- EXPECT_EQ(value.get(), "bar");
+ string value = mgr.get<string>("foo");
+ EXPECT_EQ(value, "bar");
}
TEST_F(SaveManagerTest, DefaultValue) {
@@ -36,5 +36,16 @@ TEST_F(SaveManagerTest, DefaultValue) {
ASSERT_EQ(value.get(), 3);
value.set(5);
- ASSERT_EQ(value.get(), 5);
+ EXPECT_EQ(value.get(), 5);
+}
+
+TEST_F(SaveManagerTest, MultipleKeys) {
+ ValueBroker foo = mgr.get<int>("foo", 1);
+ ValueBroker bar = mgr.get<int>("bar", 2);
+
+ EXPECT_EQ(foo.get(), 1);
+ EXPECT_EQ(bar.get(), 2);
+
+ EXPECT_EQ(mgr.get<int>("foo"), 1);
+ EXPECT_EQ(mgr.get<int>("bar"), 2);
}
diff --git a/src/test/main.cpp b/src/test/main.cpp
index ed2aed5..0e1bc75 100644
--- a/src/test/main.cpp
+++ b/src/test/main.cpp
@@ -1,6 +1,7 @@
-#include <crepe/api/Config.h>
#include <gtest/gtest.h>
+#include <crepe/api/Config.h>
+
using namespace crepe;
using namespace testing;