19 #include <gtest/gtest.h>
34 uint8_t* buf_ptr =
static_cast<uint8_t*
>(buf);
36 EXPECT_EQ(value, val);
37 int len = buf_ptr - buf;
39 EXPECT_LE(len,
sizeof(buf));
47 uint8_t* buf_ptr =
static_cast<uint8_t*
>(buf);
49 EXPECT_EQ(value, val);
50 int len = buf_ptr - buf;
52 EXPECT_LE(len,
sizeof(buf));
73 int32_t value = 0xa2a2a2a2;
74 for (
int i = 0; i < 1000; ++i) {
78 TestZLong((static_cast<int64_t>(value) << 32) | value);
83 int main(
int argc,
char **argv) {
85 ::testing::InitGoogleTest(&argc, argv);
86 return RUN_ALL_TESTS();
static const int MAX_ZINT_LEN
Maximum lengths for Zigzag encodings.
static int PutZInt(int32_t integer, uint8_t *buf)
Put a zigzag encoded integer into a buffer and return its length.
void TestZInt(int32_t value)
static int64_t ReadZLong(uint8_t **buf)
static uint32_t Hash(const void *data, int32_t bytes, uint32_t seed)
void TestZLong(int64_t value)
static const int MAX_ZLONG_LEN
static int32_t ReadZInt(uint8_t **buf)
Read a zig-zag encoded int.
int main(int argc, char **argv)
static void Init()
Initialize CpuInfo.
static int PutZLong(int64_t longint, uint8_t *buf)
Put a zigzag encoded long integer into a buffer and return its length.