| 34 | using namespace bytedance::bolt; |
| 35 | |
| 36 | TEST(StringIdMapTest, basic) { |
| 37 | constexpr const char* kFile1 = "file_1"; |
| 38 | StringIdMap map; |
| 39 | uint64_t id = 0; |
| 40 | { |
| 41 | StringIdLease lease1; |
| 42 | EXPECT_FALSE(lease1.hasValue()); |
| 43 | StringIdLease lease2(map, kFile1); |
| 44 | EXPECT_TRUE(lease2.hasValue()); |
| 45 | id = lease2.id(); |
| 46 | lease1 = lease2; |
| 47 | EXPECT_EQ(id, lease1.id()); |
| 48 | EXPECT_EQ(strlen(kFile1), map.pinnedSize()); |
| 49 | } |
| 50 | StringIdLease lease3(map, kFile1); |
| 51 | EXPECT_NE(lease3.id(), id); |
| 52 | lease3.clear(); |
| 53 | EXPECT_EQ(0, map.pinnedSize()); |
| 54 | } |
| 55 | |
| 56 | TEST(StringIdMapTest, rehash) { |
| 57 | constexpr int32_t kCount = 10000; |
nothing calls this directly
no test coverage detected