MCPcopy Create free account
hub / github.com/apache/impala / TEST

Function TEST

be/src/kudu/util/slice-test.cc:35–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33typedef SliceMap<int>::type MySliceMap;
34
35TEST(SliceTest, TestSliceMap) {
36 MySliceMap my_map;
37 Slice a("a");
38 Slice b("b");
39 Slice c("c");
40
41 // Insertion is deliberately out-of-order; the map should restore order.
42 InsertOrDie(&my_map, c, 3);
43 InsertOrDie(&my_map, a, 1);
44 InsertOrDie(&my_map, b, 2);
45
46 int expectedValue = 0;
47 for (const MySliceMap::value_type& pair : my_map) {
48 int data = 'a' + expectedValue++;
49 ASSERT_EQ(Slice(reinterpret_cast<uint8_t*>(&data), 1), pair.first);
50 ASSERT_EQ(expectedValue, pair.second);
51 }
52
53 expectedValue = 0;
54 for (auto iter = my_map.begin(); iter != my_map.end(); iter++) {
55 int data = 'a' + expectedValue++;
56 ASSERT_EQ(Slice(reinterpret_cast<uint8_t*>(&data), 1), iter->first);
57 ASSERT_EQ(expectedValue, iter->second);
58 }
59}
60
61} // namespace kudu

Callers

nothing calls this directly

Calls 4

InsertOrDieFunction · 0.85
SliceClass · 0.70
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected