diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /util/digest/murmur_ut.cpp | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'util/digest/murmur_ut.cpp')
-rw-r--r-- | util/digest/murmur_ut.cpp | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/util/digest/murmur_ut.cpp b/util/digest/murmur_ut.cpp index b12195bc7e..29287668bc 100644 --- a/util/digest/murmur_ut.cpp +++ b/util/digest/murmur_ut.cpp @@ -1,32 +1,32 @@ -#include "murmur.h" - +#include "murmur.h" + #include <library/cpp/testing/unittest/registar.h> - -class TMurmurHashTest: public TTestBase { - UNIT_TEST_SUITE(TMurmurHashTest); - UNIT_TEST(TestHash32) + +class TMurmurHashTest: public TTestBase { + UNIT_TEST_SUITE(TMurmurHashTest); + UNIT_TEST(TestHash32) UNIT_TEST(TestUnalignedHash32) - UNIT_TEST(TestHash64) + UNIT_TEST(TestHash64) UNIT_TEST(TestUnalignedHash64) UNIT_TEST(TestWrapperBiggerTypes) - UNIT_TEST_SUITE_END(); - -private: - inline void TestHash32() { - ui8 buf[256]; - - for (size_t i = 0; i < 256; ++i) { - buf[i] = i; - } - - Test<ui32>(buf, 256, 2373126550UL); + UNIT_TEST_SUITE_END(); + +private: + inline void TestHash32() { + ui8 buf[256]; + + for (size_t i = 0; i < 256; ++i) { + buf[i] = i; + } + + Test<ui32>(buf, 256, 2373126550UL); TestWrapper<ui8, ui32>({buf, buf + 256}, 2373126550UL); - Test<ui32>(buf, 255, 3301607533UL); - Test<ui32>(buf, 254, 2547410121UL); - Test<ui32>(buf, 253, 80030810UL); - } - + Test<ui32>(buf, 255, 3301607533UL); + Test<ui32>(buf, 254, 2547410121UL); + Test<ui32>(buf, 253, 80030810UL); + } + inline void TestUnalignedHash32() { ui8 buf[257]; ui8* unalignedBuf = buf + 1; @@ -38,20 +38,20 @@ private: Test<ui32>(unalignedBuf, 256, 2373126550UL); } - inline void TestHash64() { - ui8 buf[256]; - - for (size_t i = 0; i < 256; ++i) { - buf[i] = i; - } - - Test<ui64>(buf, 256, ULL(12604435678857905857)); + inline void TestHash64() { + ui8 buf[256]; + + for (size_t i = 0; i < 256; ++i) { + buf[i] = i; + } + + Test<ui64>(buf, 256, ULL(12604435678857905857)); TestWrapper<ui8, ui64>({buf, buf + 256}, ULL(12604435678857905857)); - Test<ui64>(buf, 255, ULL(1708835094528446095)); - Test<ui64>(buf, 254, ULL(5077937678736514994)); - Test<ui64>(buf, 253, ULL(11553864555081396353)); - } - + Test<ui64>(buf, 255, ULL(1708835094528446095)); + Test<ui64>(buf, 254, ULL(5077937678736514994)); + Test<ui64>(buf, 253, ULL(11553864555081396353)); + } + inline void TestUnalignedHash64() { ui8 buf[257]; ui8* unalignedBuf = buf + 1; @@ -69,17 +69,17 @@ private: TestWrapper<ui32, ui64>({buf, buf + 2}, MurmurHash<ui64>(buf, sizeof(ui32) * 2)); } -private: - template <class T> - inline void Test(const void* data, size_t len, T expected) { - UNIT_ASSERT_STRINGS_EQUAL(ToString(MurmurHash<T>(data, len)), ToString(expected)); - } +private: + template <class T> + inline void Test(const void* data, size_t len, T expected) { + UNIT_ASSERT_STRINGS_EQUAL(ToString(MurmurHash<T>(data, len)), ToString(expected)); + } template <class E, class T> inline void TestWrapper(const TArrayRef<E>& array, T expected) { auto val = TMurmurHash<T>()(array); UNIT_ASSERT_EQUAL(val, expected); } -}; - -UNIT_TEST_SUITE_REGISTRATION(TMurmurHashTest); +}; + +UNIT_TEST_SUITE_REGISTRATION(TMurmurHashTest); |