/
githubmirror
/
nbs
Обзор
Документация
Войти
/
githubmirror
/
nbs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
util/generic/string_transparent_hash_ut.cpp
19 строк
750 B
qkrorlqr
Initial NBS OpenSource export
28 апр 2023, 21:54
28 апр 2023, 21:54
783a858
Код
Авторство
О чём код?
#include "string.h" #include "vector.h" #include "strbuf.h" #include <library/cpp/testing/unittest/registar.h> #include <library/cpp/containers/absl_flat_hash/flat_hash_set.h> #include <util/str_stl.h> Y_UNIT_TEST_SUITE(StringHashFunctorTests) { Y_UNIT_TEST(TestTransparencyWithUnorderedSet) { // Using Abseil hash set because `std::unordered_set` is transparent only from C++20 (while // we stuck with C++17 right now). absl::flat_hash_set<TString, THash<TString>, TEqualTo<TString>> 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()); } }