MCPcopy Create free account
hub / github.com/apache/arrow / TestZigZag

Function TestZigZag

cpp/src/arrow/util/bit_util_test.cc:936–947  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

934}
935
936static void TestZigZag(int32_t v, std::array<uint8_t, 5> buffer_expect) {
937 uint8_t buffer[bit_util::kMaxLEB128ByteLenFor<int32_t>] = {};
938 bit_util::BitWriter writer(buffer, sizeof(buffer));
939 writer.PutZigZagVlqInt(v);
940 // WARNING: The reader reads and caches the input when created, so it must be created
941 // after the data is written in the buffer.
942 bit_util::BitReader reader(buffer, sizeof(buffer));
943 EXPECT_THAT(buffer, testing::ElementsAreArray(buffer_expect));
944 int32_t result;
945 EXPECT_TRUE(reader.GetZigZagVlqInt(&result));
946 EXPECT_EQ(v, result);
947}
948
949TEST(BitStreamUtil, ZigZag) {
950 TestZigZag(0, {0, 0, 0, 0, 0});

Callers 1

TESTFunction · 0.85

Calls 2

PutZigZagVlqIntMethod · 0.80
GetZigZagVlqIntMethod · 0.80

Tested by

no test coverage detected