summaryrefslogtreecommitdiff
path: root/test/std/utilities/function.objects/unord.hash
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/utilities/function.objects/unord.hash')
-rw-r--r--test/std/utilities/function.objects/unord.hash/enum.pass.cpp6
-rw-r--r--test/std/utilities/function.objects/unord.hash/floating.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/unord.hash/integral.pass.cpp21
3 files changed, 20 insertions, 9 deletions
diff --git a/test/std/utilities/function.objects/unord.hash/enum.pass.cpp b/test/std/utilities/function.objects/unord.hash/enum.pass.cpp
index bd92a4ac4d2e..8aa2c1df8935 100644
--- a/test/std/utilities/function.objects/unord.hash/enum.pass.cpp
+++ b/test/std/utilities/function.objects/unord.hash/enum.pass.cpp
@@ -12,7 +12,9 @@
// make sure that we can hash enumeration values
// Not very portable
-#if __cplusplus >= 201402L
+#include "test_macros.h"
+
+#if TEST_STD_VER >= 14
#include <functional>
#include <cassert>
@@ -35,7 +37,7 @@ test()
static_assert((std::is_same<typename H::argument_type, T>::value), "" );
static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
typedef typename std::underlying_type<T>::type under_type;
-
+
H h1;
std::hash<under_type> h2;
for (int i = 0; i <= 5; ++i)
diff --git a/test/std/utilities/function.objects/unord.hash/floating.pass.cpp b/test/std/utilities/function.objects/unord.hash/floating.pass.cpp
index f1f198f23599..643e2d8c5d86 100644
--- a/test/std/utilities/function.objects/unord.hash/floating.pass.cpp
+++ b/test/std/utilities/function.objects/unord.hash/floating.pass.cpp
@@ -35,7 +35,7 @@ test()
std::size_t t0 = h(0.);
std::size_t tn0 = h(-0.);
- std::size_t tp1 = h(0.1);
+ std::size_t tp1 = h(static_cast<T>(0.1));
std::size_t t1 = h(1);
std::size_t tn1 = h(-1);
std::size_t pinf = h(INFINITY);
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
}