Files
ankerl_unordered_dense/test/unit/hash.cpp
Martin Leitner-Ankerl 39f9a06655 Fix compile issues with recent compilers
* Update wrap files
* Ignore clang's warning in doctest:

<ciso646> is not a standard header since C++20, use <version> to detect implementation-specific macros" [-Werror,-W#warnings]

Make sure app/doctest.h is used everywhere instead of directly including the header, so the warning is disabled everywhere
2025-10-05 15:50:02 +02:00

20 lines
581 B
C++

#include <ankerl/unordered_dense.h>
#include <app/doctest.h> // for ResultBuilder, TestCase, REQUIRE
#include <cstddef> // for size_t
#include <cstdint> // for uint64_t
#include <string> // for string, basic_string
#include <unordered_set> // for unordered_set
TEST_CASE("hash_string") {
auto h = ankerl::unordered_dense::hash<std::string>();
auto set = std::unordered_set<uint64_t>();
auto str = std::string();
for (size_t l = 0; l < 100; ++l) {
set.insert(h(str));
str.push_back('x');
}
REQUIRE(set.size() == 100);
}