MCPcopy Create free account
hub / github.com/ElementsProject/elements / TEST

Function TEST

src/leveldb/util/crc32c_test.cc:13–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11class CRC {};
12
13TEST(CRC, StandardResults) {
14 // From rfc3720 section B.4.
15 char buf[32];
16
17 memset(buf, 0, sizeof(buf));
18 ASSERT_EQ(0x8a9136aa, Value(buf, sizeof(buf)));
19
20 memset(buf, 0xff, sizeof(buf));
21 ASSERT_EQ(0x62a8ab43, Value(buf, sizeof(buf)));
22
23 for (int i = 0; i < 32; i++) {
24 buf[i] = i;
25 }
26 ASSERT_EQ(0x46dd794e, Value(buf, sizeof(buf)));
27
28 for (int i = 0; i < 32; i++) {
29 buf[i] = 31 - i;
30 }
31 ASSERT_EQ(0x113fdb5c, Value(buf, sizeof(buf)));
32
33 uint8_t data[48] = {
34 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
35 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
36 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x18, 0x28, 0x00, 0x00, 0x00,
37 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
38 };
39 ASSERT_EQ(0xd9963a56, Value(reinterpret_cast<char*>(data), sizeof(data)));
40}
41
42TEST(CRC, Values) { ASSERT_NE(Value("a", 1), Value("foo", 3)); }
43

Callers

nothing calls this directly

Calls 4

ValueFunction · 0.85
UnmaskFunction · 0.85
ExtendFunction · 0.70
MaskFunction · 0.70

Tested by

no test coverage detected