diff options
author | breakneck <[email protected]> | 2022-02-10 16:47:58 +0300 |
---|---|---|
committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:47:58 +0300 |
commit | e2021f9a0e54d13b7c48796318b13b66dc625e74 (patch) | |
tree | 5aed1691033eaf399ab80a10a137238922035fa8 /util/digest/sequence_ut.cpp | |
parent | 83602b1b564b92a80a1526d113fa2846661dd10e (diff) |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'util/digest/sequence_ut.cpp')
-rw-r--r-- | util/digest/sequence_ut.cpp | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/util/digest/sequence_ut.cpp b/util/digest/sequence_ut.cpp index 87d6102ee59..f49ebc9638b 100644 --- a/util/digest/sequence_ut.cpp +++ b/util/digest/sequence_ut.cpp @@ -1,62 +1,62 @@ -#include "sequence.h" - +#include "sequence.h" + #include <library/cpp/testing/unittest/registar.h> #include <util/generic/map.h> -#include <util/generic/vector.h> - -class TRangeHashTest: public TTestBase { - UNIT_TEST_SUITE(TRangeHashTest); - UNIT_TEST(TestStrokaInt) - UNIT_TEST(TestIntVector) - UNIT_TEST(TestOneElement) +#include <util/generic/vector.h> + +class TRangeHashTest: public TTestBase { + UNIT_TEST_SUITE(TRangeHashTest); + UNIT_TEST(TestStrokaInt) + UNIT_TEST(TestIntVector) + UNIT_TEST(TestOneElement) UNIT_TEST(TestMap); - UNIT_TEST(TestCollectionIndependancy); - UNIT_TEST_SUITE_END(); - -private: - inline void TestStrokaInt() { + UNIT_TEST(TestCollectionIndependancy); + UNIT_TEST_SUITE_END(); + +private: + inline void TestStrokaInt() { const size_t canonicalHash = static_cast<size_t>(ULL(12727184940294366172)); UNIT_ASSERT_EQUAL(canonicalHash, TRangeHash<>()(TString("12345"))); - } - - inline void TestIntVector() { + } + + inline void TestIntVector() { const size_t canonicalHash = static_cast<size_t>(ULL(1351128487744230578)); TVector<int> testVec = {1, 2, 4, 3}; - UNIT_ASSERT_EQUAL(canonicalHash, TRangeHash<>()(testVec)); - } - - inline void TestOneElement() { - const int testVal = 42; + UNIT_ASSERT_EQUAL(canonicalHash, TRangeHash<>()(testVec)); + } + + inline void TestOneElement() { + const int testVal = 42; TVector<int> testVec = {testVal}; - UNIT_ASSERT_UNEQUAL(THash<int>()(testVal), TRangeHash<>()(testVec)); - } - + UNIT_ASSERT_UNEQUAL(THash<int>()(testVal), TRangeHash<>()(testVec)); + } + inline void TestMap() { const size_t canonicalHash = static_cast<size_t>(ULL(4415387926488545605)); TMap<TString, int> testMap{{"foo", 123}, {"bar", 456}}; UNIT_ASSERT_EQUAL(canonicalHash, TRangeHash<>()(testMap)); } - inline void TestCollectionIndependancy() { + inline void TestCollectionIndependancy() { TVector<char> testVec = {'a', 'b', 'c'}; TString testStroka = "abc"; - UNIT_ASSERT_EQUAL(TRangeHash<>()(testVec), TRangeHash<>()(testStroka)); - } -}; - + UNIT_ASSERT_EQUAL(TRangeHash<>()(testVec), TRangeHash<>()(testStroka)); + } +}; + class TSequenceHashTest: public TTestBase { - UNIT_TEST_SUITE(TSequenceHashTest); - UNIT_TEST(TestSimpleBuffer) - UNIT_TEST_SUITE_END(); + UNIT_TEST_SUITE(TSequenceHashTest); + UNIT_TEST(TestSimpleBuffer) + UNIT_TEST_SUITE_END(); -private: - inline void TestSimpleBuffer() { - int arr[] = {1, 2, 3}; +private: + inline void TestSimpleBuffer() { + int arr[] = {1, 2, 3}; const size_t canonicalHash = static_cast<size_t>(ULL(3903918011533391876)); - TContiguousHash<TSimpleRangeHash> hasher; + TContiguousHash<TSimpleRangeHash> hasher; UNIT_ASSERT_EQUAL(canonicalHash, hasher(TArrayRef<int>(arr, arr + 3))); - } -}; - -UNIT_TEST_SUITE_REGISTRATION(TRangeHashTest); -UNIT_TEST_SUITE_REGISTRATION(TSequenceHashTest); + } +}; + +UNIT_TEST_SUITE_REGISTRATION(TRangeHashTest); +UNIT_TEST_SUITE_REGISTRATION(TSequenceHashTest); |