aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-12-14 16:20:49 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-12-14 16:20:49 +0100
commit6bc0025e4c24ed6659d993f3469c10615fb0e273 (patch)
tree48fba6d397630a4cae0a7ffc44660ce5d053896e /src/test
parent5ae2b3c2f7dc207980c6d475e54fa2c5242c560d (diff)
fix DB facade + add regression tests
Diffstat (limited to 'src/test')
-rw-r--r--src/test/DBTest.cpp9
-rw-r--r--src/test/SaveManagerTest.cpp13
2 files changed, 21 insertions, 1 deletions
diff --git a/src/test/DBTest.cpp b/src/test/DBTest.cpp
index 99dedff..0c98e10 100644
--- a/src/test/DBTest.cpp
+++ b/src/test/DBTest.cpp
@@ -27,3 +27,12 @@ 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 0209f6a..7609e69 100644
--- a/src/test/SaveManagerTest.cpp
+++ b/src/test/SaveManagerTest.cpp
@@ -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);
}