summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2023-01-02 21:00:10 +0100
committerRoland Reichwein <mail@reichwein.it>2023-01-02 21:00:10 +0100
commit676e924f7c5bd780250a80187bfcb74550348af7 (patch)
treea9ad983eb5ef2e29713d5630270496f24df36a67 /tests
parentb1c99b0c3b0a8d65f237f507ad238ce441233b3f (diff)
Added tests
Diffstat (limited to 'tests')
-rw-r--r--tests/test-storage.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test-storage.cpp b/tests/test-storage.cpp
index b9994fb..1f3eda4 100644
--- a/tests/test-storage.cpp
+++ b/tests/test-storage.cpp
@@ -206,3 +206,29 @@ TEST_F(StorageTest, revision_increment)
EXPECT_EQ(storage.getRevision("iabc"), 0);
}
+TEST_F(StorageTest, generate_id)
+{
+ Storage storage(*m_config);
+ std::string a{storage.generate_id()};
+ std::string b{storage.generate_id()};
+
+ EXPECT_NE(a, b);
+ EXPECT_NE(a, "");
+ EXPECT_NE(b, "");
+
+ EXPECT_GE(a.size(), 6);
+
+}
+
+TEST_F(StorageTest, checksum32)
+{
+ Storage storage(*m_config);
+ EXPECT_EQ(storage.checksum32(""), 0);
+ EXPECT_EQ(storage.checksum32("0"), 48);
+ EXPECT_EQ(storage.checksum32("\x00"), 0);
+ EXPECT_EQ(storage.checksum32("123"), 1073741862);
+ EXPECT_EQ(storage.checksum32("a"), 97);
+ EXPECT_EQ(storage.checksum32("ab"), 82);
+ EXPECT_EQ(storage.checksum32("abc"), 1073741898);
+}
+