diff options
Diffstat (limited to 'test/std/utilities/function.objects/unord.hash/integral.pass.cpp')
-rw-r--r-- | test/std/utilities/function.objects/unord.hash/integral.pass.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/test/std/utilities/function.objects/unord.hash/integral.pass.cpp b/test/std/utilities/function.objects/unord.hash/integral.pass.cpp index c20f31ff2c99..8954f4f3664b 100644 --- a/test/std/utilities/function.objects/unord.hash/integral.pass.cpp +++ b/test/std/utilities/function.objects/unord.hash/integral.pass.cpp @@ -16,14 +16,14 @@ // size_t operator()(T val) const; // }; -// Not very portable - #include <functional> #include <cassert> #include <type_traits> #include <cstddef> #include <limits> +#include "test_macros.h" + template <class T> void test() @@ -37,7 +37,11 @@ test() { T t(i); if (sizeof(T) <= sizeof(std::size_t)) - assert(h(t) == t); + { + const std::size_t result = h(t); + LIBCPP_ASSERT(result == t); + ((void)result); // Prevent unused warning + } } } @@ -67,7 +71,7 @@ int main() test<int16_t>(); test<int32_t>(); test<int64_t>(); - + test<int_fast8_t>(); test<int_fast16_t>(); test<int_fast32_t>(); @@ -80,12 +84,12 @@ int main() test<intmax_t>(); test<intptr_t>(); - + test<uint8_t>(); test<uint16_t>(); test<uint32_t>(); test<uint64_t>(); - + test<uint_fast8_t>(); test<uint_fast16_t>(); test<uint_fast32_t>(); @@ -98,4 +102,9 @@ int main() test<uintmax_t>(); test<uintptr_t>(); + +#ifndef _LIBCPP_HAS_NO_INT128 + test<__int128_t>(); + test<__uint128_t>(); +#endif } |