[blotmapvector] Add support for try_emplace.

I am going to use this in a forthcoming commit.
This commit is contained in:
Michael Gottesman
2020-03-24 22:43:37 -07:00
parent 1beb37e1b5
commit c5f6038a0a
2 changed files with 46 additions and 8 deletions

View File

@@ -464,6 +464,19 @@ TYPED_TEST(BlotMapVectorTest, InsertTest) {
this->NumExpectedLiveTesters = 1;
}
// Test try_emplace() method
TYPED_TEST(BlotMapVectorTest, TryEmplaceTest) {
this->Map.try_emplace(this->getKey(), this->getValue());
EXPECT_EQ(1u, this->Map.size());
EXPECT_EQ(this->getValue(), this->Map[this->getKey()]);
EXPECT_EQ(1u, this->Map.size());
this->Map.try_emplace(this->getKey(), this->getValue());
EXPECT_EQ(1u, this->Map.size());
EXPECT_EQ(this->getValue(), this->Map[this->getKey()]);
EXPECT_EQ(1u, this->Map.size());
this->NumExpectedLiveTesters = 1;
}
// Test copy constructor method
TYPED_TEST(BlotMapVectorTest, CopyConstructorTest) {
this->Map[this->getKey()] = this->getValue();