mirror of
https://github.com/martinus/unordered_dense.git
synced 2026-01-18 17:21:27 +01:00
* 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
22 lines
711 B
C++
22 lines
711 B
C++
#include <ankerl/unordered_dense.h>
|
|
|
|
#include <app/doctest.h> // for ResultBuilder, TestCase, REQUIRE
|
|
|
|
#include <cstdint> // for uint64_t
|
|
#include <memory> // for shared_ptr, __unique_ptr_t, make...
|
|
#include <type_traits> // for declval
|
|
|
|
template <typename Ptr>
|
|
void check(Ptr const& ptr) {
|
|
REQUIRE(ankerl::unordered_dense::hash<Ptr>{}(ptr) ==
|
|
ankerl::unordered_dense::hash<decltype(std::declval<Ptr>().get())>{}(ptr.get()));
|
|
}
|
|
|
|
TEST_CASE("hash_smart_ptr") {
|
|
check(std::unique_ptr<uint64_t>{});
|
|
check(std::shared_ptr<uint64_t>{});
|
|
check(std::make_shared<uint64_t>(123U));
|
|
check(std::make_unique<uint64_t>(123U));
|
|
check(std::make_unique<uint64_t>(uint64_t{123U}));
|
|
}
|