Add some test cases for the consistency of the generated myClientId.

This commit is contained in:
Sebastian Messmer 2016-06-26 17:02:51 -07:00
parent be8dffb24d
commit 7bf84b1948
1 changed files with 13 additions and 0 deletions

View File

@ -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);
}