| 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 | { |
no test coverage detected