MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TEST

Function TEST

tensorflow/core/lib/hash/crc32c_test.cc:24–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22namespace crc32c {
23
24TEST(CRC, StandardResults) {
25 // From rfc3720 section B.4.
26 char buf[32];
27
28 memset(buf, 0, sizeof(buf));
29 ASSERT_EQ(0x8a9136aa, Value(buf, sizeof(buf)));
30
31 memset(buf, 0xff, sizeof(buf));
32 ASSERT_EQ(0x62a8ab43, Value(buf, sizeof(buf)));
33
34 for (int i = 0; i < 32; i++) {
35 buf[i] = i;
36 }
37 ASSERT_EQ(0x46dd794e, Value(buf, sizeof(buf)));
38
39 for (int i = 0; i < 32; i++) {
40 buf[i] = 31 - i;
41 }
42 ASSERT_EQ(0x113fdb5c, Value(buf, sizeof(buf)));
43
44 unsigned char data[48] = {
45 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
46 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
47 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x18, 0x28, 0x00, 0x00, 0x00,
48 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
49 };
50 ASSERT_EQ(0xd9963a56, Value(reinterpret_cast<char*>(data), sizeof(data)));
51
52 // Try unaligned sizes and offsets.
53 // Accelerated and unaccelerated code both produce these results.
54 ASSERT_EQ(0xdd1b19be, Value(reinterpret_cast<char*>(data), sizeof(data) - 7));
55 ASSERT_EQ(0x4930c4b1,
56 Value(reinterpret_cast<char*>(data) + 1, sizeof(data) - 4));
57}
58
59TEST(CRC, Values) { ASSERT_NE(Value("a", 1), Value("foo", 3)); }
60

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected