#include "fnv.h" #include Y_UNIT_TEST_SUITE(TFnvTest) { Y_UNIT_TEST(TestFnv32) { const auto h32 = ULL(2849763999); UNIT_ASSERT_EQUAL(FnvHash("1234567", 7), h32); UNIT_ASSERT_EQUAL(FnvHash(TStringBuf("1234567")), h32); UNIT_ASSERT_EQUAL(FnvHash(nullptr, 0), FNV32INIT); UNIT_ASSERT_EQUAL(FnvHash(TStringBuf()), FNV32INIT); } Y_UNIT_TEST(TestFnv64) { const auto h64 = ULL(2449551094593701855); UNIT_ASSERT_EQUAL(FnvHash("1234567", 7), h64); UNIT_ASSERT_EQUAL(FnvHash(TStringBuf("1234567")), h64); UNIT_ASSERT_EQUAL(FnvHash(nullptr, 0), FNV64INIT); UNIT_ASSERT_EQUAL(FnvHash(TStringBuf()), FNV64INIT); } }