From 7bf84b19489f2b797d31bec39e46aaa58009512b Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Sun, 26 Jun 2016 17:02:51 -0700 Subject: [PATCH] Add some test cases for the consistency of the generated myClientId. --- test/cryfs/config/CryConfigLoaderTest.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/cryfs/config/CryConfigLoaderTest.cpp b/test/cryfs/config/CryConfigLoaderTest.cpp index f12f7a23..53361bae 100644 --- a/test/cryfs/config/CryConfigLoaderTest.cpp +++ b/test/cryfs/config/CryConfigLoaderTest.cpp @@ -271,3 +271,16 @@ TEST_F(CryConfigLoaderTest, DontMigrateWhenAnsweredNo) { EXPECT_THAT(e.what(), HasSubstr("Not migrating file system")); } } + +TEST_F(CryConfigLoaderTest, MyClientIdIsIndeterministic) { + TempFile file1(false); + TempFile file2(false); + uint32_t myClientId = loader("mypassword", true).loadOrCreate(file1.path()).value().myClientId; + EXPECT_NE(myClientId, loader("mypassword", true).loadOrCreate(file2.path()).value().myClientId); +} + +TEST_F(CryConfigLoaderTest, MyClientIdIsLoadedCorrectly) { + TempFile file(false); + uint32_t myClientId = loader("mypassword", true).loadOrCreate(file.path()).value().myClientId; + EXPECT_EQ(myClientId, loader("mypassword", true).loadOrCreate(file.path()).value().myClientId); +}