#include "string.h" #include "vector.h" #include "strbuf.h" #include #include #ifdef __cpp_lib_generic_unordered_lookup #include template using THashSetType = std::unordered_set; #else // Using Abseil hash set because `std::unordered_set` is transparent only from libstdc++11. // Meanwhile clang-linux-x86_64-release-stl-system autocheck sets OS_SDK=ubuntu-20, // that support libstdc++10 by default. #include template using THashSetType = absl::flat_hash_set; #endif Y_UNIT_TEST_SUITE(StringHashFunctorTests) { Y_UNIT_TEST(TestTransparencyWithUnorderedSet) { THashSetType, TEqualTo> s = {"foo"}; // If either `THash` or `TEqualTo` is not transparent compilation will fail. UNIT_ASSERT_UNEQUAL(s.find(TStringBuf("foo")), s.end()); UNIT_ASSERT_EQUAL(s.find(TStringBuf("bar")), s.end()); } } // Y_UNIT_TEST_SUITE(StringHashFunctorTests)