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

Function TEST

tensorflow/core/lib/hash/hash_test.cc:28–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26namespace tensorflow {
27
28TEST(Hash, SignedUnsignedIssue) {
29 const unsigned char d1[1] = {0x62};
30 const unsigned char d2[2] = {0xc3, 0x97};
31 const unsigned char d3[3] = {0xe2, 0x99, 0xa5};
32 const unsigned char d4[4] = {0xe1, 0x80, 0xb9, 0x32};
33 const unsigned char d5[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
40 struct Case {
41 uint32 hash32;
42 uint64 hash64;
43 const unsigned char* data;
44 size_t size;
45 uint32 seed;
46 };
47
48 for (Case c : std::vector<Case>{
49 {0x471a8188u, 0x4c61ea3eeda4cb87ull, nullptr, 0, 0xbc9f1d34},
50 {0xd615eba5u, 0x091309f7ef916c8aull, d1, sizeof(d1), 0xbc9f1d34},
51 {0x0c3cccdau, 0xa815bcdf1d1af01cull, d2, sizeof(d2), 0xbc9f1d34},
52 {0x3ba37e0eu, 0x02167564e4d06430ull, d3, sizeof(d3), 0xbc9f1d34},
53 {0x16174eb3u, 0x8f7ed82ffc21071full, d4, sizeof(d4), 0xbc9f1d34},
54 {0x98b1926cu, 0xce196580c97aff1eull, d5, sizeof(d5), 0x12345678},
55 }) {
56 EXPECT_EQ(c.hash32,
57 Hash32(reinterpret_cast<const char*>(c.data), c.size, c.seed));
58 EXPECT_EQ(c.hash64,
59 Hash64(reinterpret_cast<const char*>(c.data), c.size, c.seed));
60
61 // Check hashes with inputs aligned differently.
62 for (int align = 1; align <= 7; align++) {
63 std::string input(align, 'x');
64 input.append(reinterpret_cast<const char*>(c.data), c.size);
65 EXPECT_EQ(c.hash32, Hash32(&input[align], c.size, c.seed));
66 EXPECT_EQ(c.hash64, Hash64(&input[align], c.size, c.seed));
67 }
68 }
69}
70
71TEST(Hash, SignedUnsignedIssueHash64V3) {
72 const unsigned char d1[1] = {0x62};

Callers

nothing calls this directly

Calls 12

Hash32Function · 0.85
Hash64V3Function · 0.85
Fingerprint64Function · 0.85
Hash64V3_Batch512Function · 0.85
Hash64Farm_Batch512Function · 0.85
Hash64Function · 0.70
appendMethod · 0.45
insertMethod · 0.45
sizeMethod · 0.45
findMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected