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

Function TestZigZag64

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

Source from the content-addressed store, hash-verified

958}
959
960static void TestZigZag64(int64_t v, std::array<uint8_t, 10> buffer_expect) {
961 uint8_t buffer[bit_util::kMaxLEB128ByteLenFor<int64_t>] = {};
962 bit_util::BitWriter writer(buffer, sizeof(buffer));
963 writer.PutZigZagVlqInt(v);
964 // WARNING: The reader reads and caches the input when created, so it must be created
965 // after the data is written in the buffer.
966 bit_util::BitReader reader(buffer, sizeof(buffer));
967 EXPECT_THAT(buffer, testing::ElementsAreArray(buffer_expect));
968 int64_t result = 0;
969 EXPECT_TRUE(reader.GetZigZagVlqInt(&result));
970 EXPECT_EQ(v, result);
971}
972
973TEST(BitStreamUtil, ZigZag64) {
974 TestZigZag64(0, {0, 0, 0, 0, 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