MCPcopy Create free account
hub / github.com/davisking/dlib / murmur_hash_128_test

Function murmur_hash_128_test

dlib/test/hash.cpp:80–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78 }
79
80 void murmur_hash_128_test()
81 {
82 uint8 key[256];
83 uint64 hashes[256*2];
84 uint32 final = 0;
85
86 memset(key,0,sizeof(key));
87 memset(hashes,0,sizeof(hashes));
88
89 // Hash keys of the form {0}, {0,1}, {0,1,2}... up to N=255,using 256-N as
90 // the seed.
91 for(int i = 0; i < 256; i++)
92 {
93 key[i] = (uint8)i;
94
95 const std::pair<uint64,uint64> temp = murmur_hash3_128bit(key,i,256-i);
96 hashes[2*i] = temp.first;
97 hashes[2*i+1] = temp.second;
98 }
99
100 byte_orderer bo;
101 bo.host_to_little(hashes);
102 final = static_cast<uint32>(murmur_hash3_128bit(hashes,sizeof(hashes),0).first);
103
104 // using ostringstream to avoid compiler error in visual studio 2005
105 ostringstream sout;
106 sout << hex << final;
107 dlog << LINFO << "final 64: "<< sout.str();
108 DLIB_TEST(final == 0x6384BA69);
109 }
110
111 void test_murmur_hash_128_4()
112 {

Callers 1

perform_testMethod · 0.85

Calls 3

murmur_hash3_128bitFunction · 0.85
host_to_littleMethod · 0.80
strMethod · 0.45

Tested by

no test coverage detected