diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-storage.cpp | 26 |
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); +} + |