write first version of user system
This commit is contained in:
17
test/hash_collision_test.cpp
Normal file
17
test/hash_collision_test.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include "../src/include/utils.h"
|
||||
std::unordered_map<hash_t, std::string> storage;
|
||||
int main() {
|
||||
std::string token;
|
||||
while (std::cin >> token) {
|
||||
hash_t hsh = SplitMix64Hash(token);
|
||||
if (storage.find(hsh) == storage.end()) {
|
||||
storage[hsh] = token;
|
||||
} else if (storage[hsh] != token) {
|
||||
std::cerr << "Collision detected: " << storage[hsh] << " " << token << std::endl;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user