Add FlatHashSet initialization test.
This commit is contained in:
parent
bd480941a1
commit
46b6ba578f
@ -92,6 +92,20 @@ static bool operator==(const A &lhs, const A &rhs) {
|
||||
return lhs.a == rhs.a;
|
||||
}
|
||||
|
||||
TEST(FlatHashSet, init) {
|
||||
td::FlatHashSet<td::Slice, td::SliceHash> s{"1", "22", "333", "4444"};
|
||||
ASSERT_TRUE(s.size() == 4);
|
||||
td::string str("1");
|
||||
ASSERT_TRUE(s.count(str) == 1);
|
||||
ASSERT_TRUE(s.count("1") == 1);
|
||||
ASSERT_TRUE(s.count("22") == 1);
|
||||
ASSERT_TRUE(s.count("333") == 1);
|
||||
ASSERT_TRUE(s.count("4444") == 1);
|
||||
ASSERT_TRUE(s.count("4") == 0);
|
||||
ASSERT_TRUE(s.count("222") == 0);
|
||||
ASSERT_TRUE(s.count("") == 0);
|
||||
}
|
||||
|
||||
TEST(FlatHashSet, foreach) {
|
||||
td::FlatHashSet<A, AHash> s;
|
||||
for (auto it : s) {
|
||||
|
Loading…
Reference in New Issue
Block a user