forked from wangyi-fudan/wyhash
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_vector.cpp
More file actions
36 lines (35 loc) · 1.02 KB
/
test_vector.cpp
File metadata and controls
36 lines (35 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <stdint.h>
#include <iostream>
#include <vector>
#include "wyhash.h"
using namespace std;
int main(void) {
vector<string> msgs_v = {
"",
"a",
"abc",
"message digest",
"abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
"1234567890123456789012345678901234567890123456789012345678901234567890"
"1234567890"
};
vector<uint64_t> etalons_v = {
0x42bc986dc5eec4d3,
0x84508dc903c31551,
0x0bc54887cfc9ecb1,
0x6e2ff3298208a67c,
0x9a64e42e897195b9,
0x9199383239c32554,
0x7c1ccf6bba30f5a5
};
uint64_t hash;
for (size_t i = 0; i < msgs_v.size(); i++) {
hash = wyhash(msgs_v[i].c_str(), msgs_v[i].size(), i, _wyp);
cout << "wyhash(\"" << msgs_v[i] << "\"," << i << ")=" << hex
<< hash << hex << "\n";
hash == etalons_v[i] ? true : cout << "\tNOK! Expected: "
<< hex << etalons_v[i] << "\n";
}
return 0;
}