| 53 | // ========================================================================== |
| 54 | |
| 55 | TEST(DictionaryEncoding, RepeatedStrings) { |
| 56 | auto col = makeStringColumn({"base", "world", "base", "base"}); |
| 57 | |
| 58 | auto encoded = dictionaryEncodeStrings(Span<const uint8_t>(col.offsets), Span<const uint8_t>(col.values), 4); |
| 59 | |
| 60 | EXPECT_EQ(encoded.count, 4u); |
| 61 | EXPECT_EQ(encoded.dictionary.size(), 2u); |
| 62 | EXPECT_EQ(encoded.dictionary[0], "base"); |
| 63 | EXPECT_EQ(encoded.dictionary[1], "world"); |
| 64 | |
| 65 | EXPECT_EQ(dictionaryLookup(encoded, 0), "base"); |
| 66 | EXPECT_EQ(dictionaryLookup(encoded, 1), "world"); |
| 67 | EXPECT_EQ(dictionaryLookup(encoded, 2), "base"); |
| 68 | EXPECT_EQ(dictionaryLookup(encoded, 3), "base"); |
| 69 | } |
| 70 | |
| 71 | TEST(DictionaryEncoding, AllUniqueStrings) { |
| 72 | auto col = makeStringColumn({"alpha", "beta", "gamma", "delta"}); |
nothing calls this directly
no test coverage detected