summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/std/utilities')
-rw-r--r--libcxx/test/std/utilities/function.objects/unord.hash/enum.pass.cpp1
-rw-r--r--libcxx/test/std/utilities/function.objects/unord.hash/floating.pass.cpp3
-rw-r--r--libcxx/test/std/utilities/function.objects/unord.hash/integral.pass.cpp51
-rw-r--r--libcxx/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp13
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp1
-rw-r--r--libcxx/test/std/utilities/optional/optional.hash/hash.pass.cpp3
-rw-r--r--libcxx/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp2
-rw-r--r--libcxx/test/std/utilities/variant/variant.hash/hash.pass.cpp1
8 files changed, 50 insertions, 25 deletions
diff --git a/libcxx/test/std/utilities/function.objects/unord.hash/enum.pass.cpp b/libcxx/test/std/utilities/function.objects/unord.hash/enum.pass.cpp
index 09ea034b767..a7ddd9a4999 100644
--- a/libcxx/test/std/utilities/function.objects/unord.hash/enum.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/unord.hash/enum.pass.cpp
@@ -36,6 +36,7 @@ test()
typedef std::hash<T> H;
static_assert((std::is_same<typename H::argument_type, T>::value), "" );
static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
+ ASSERT_NOEXCEPT(H()(T()));
typedef typename std::underlying_type<T>::type under_type;
H h1;
diff --git a/libcxx/test/std/utilities/function.objects/unord.hash/floating.pass.cpp b/libcxx/test/std/utilities/function.objects/unord.hash/floating.pass.cpp
index 643e2d8c5d8..e67aa016c1e 100644
--- a/libcxx/test/std/utilities/function.objects/unord.hash/floating.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/unord.hash/floating.pass.cpp
@@ -24,6 +24,8 @@
#include <limits>
#include <cmath>
+#include "test_macros.h"
+
template <class T>
void
test()
@@ -31,6 +33,7 @@ test()
typedef std::hash<T> H;
static_assert((std::is_same<typename H::argument_type, T>::value), "" );
static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
+ ASSERT_NOEXCEPT(H()(T()));
H h;
std::size_t t0 = h(0.);
diff --git a/libcxx/test/std/utilities/function.objects/unord.hash/integral.pass.cpp b/libcxx/test/std/utilities/function.objects/unord.hash/integral.pass.cpp
index 08a2a8c71f2..ce87f5918b2 100644
--- a/libcxx/test/std/utilities/function.objects/unord.hash/integral.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/unord.hash/integral.pass.cpp
@@ -31,6 +31,7 @@ test()
typedef std::hash<T> H;
static_assert((std::is_same<typename H::argument_type, T>::value), "" );
static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
+ ASSERT_NOEXCEPT(H()(T()));
H h;
for (int i = 0; i <= 5; ++i)
@@ -64,42 +65,42 @@ int main()
test<long long>();
test<unsigned long long>();
-// LWG #2119
+// LWG #2119
test<std::ptrdiff_t>();
test<size_t>();
- test<int8_t>();
- test<int16_t>();
- test<int32_t>();
- test<int64_t>();
+ test<int8_t>();
+ test<int16_t>();
+ test<int32_t>();
+ test<int64_t>();
- test<int_fast8_t>();
- test<int_fast16_t>();
- test<int_fast32_t>();
- test<int_fast64_t>();
+ test<int_fast8_t>();
+ test<int_fast16_t>();
+ test<int_fast32_t>();
+ test<int_fast64_t>();
- test<int_least8_t>();
- test<int_least16_t>();
- test<int_least32_t>();
- test<int_least64_t>();
+ test<int_least8_t>();
+ test<int_least16_t>();
+ test<int_least32_t>();
+ test<int_least64_t>();
test<intmax_t>();
test<intptr_t>();
- test<uint8_t>();
- test<uint16_t>();
- test<uint32_t>();
- test<uint64_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>();
- test<uint_fast64_t>();
+ test<uint_fast8_t>();
+ test<uint_fast16_t>();
+ test<uint_fast32_t>();
+ test<uint_fast64_t>();
- test<uint_least8_t>();
- test<uint_least16_t>();
- test<uint_least32_t>();
- test<uint_least64_t>();
+ test<uint_least8_t>();
+ test<uint_least16_t>();
+ test<uint_least32_t>();
+ test<uint_least64_t>();
test<uintmax_t>();
test<uintptr_t>();
diff --git a/libcxx/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp b/libcxx/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp
index a48394495e2..d71514b52ef 100644
--- a/libcxx/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp
@@ -23,6 +23,8 @@
#include <type_traits>
#include <limits>
+#include "test_macros.h"
+
template <class T>
void
test()
@@ -30,6 +32,7 @@ test()
typedef std::hash<T> H;
static_assert((std::is_same<typename H::argument_type, T>::value), "" );
static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
+ ASSERT_NOEXCEPT(H()(T()));
H h;
typedef typename std::remove_pointer<T>::type type;
@@ -38,7 +41,17 @@ test()
assert(h(&i) != h(&j));
}
+void test_nullptr()
+{
+ typedef std::nullptr_t T;
+ typedef std::hash<T> H;
+ static_assert((std::is_same<typename H::argument_type, T>::value), "" );
+ static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
+ ASSERT_NOEXCEPT(H()(T()));
+}
+
int main()
{
test<int*>();
+ test_nullptr();
}
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp
index 879ea405c75..b539e638036 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp
@@ -67,6 +67,7 @@ int main()
int* ptr = new int;
std::unique_ptr<int> p(ptr);
std::hash<std::unique_ptr<int> > f;
+ ASSERT_NOT_NOEXCEPT(f(p));
std::size_t h = f(p);
assert(h == std::hash<int*>()(ptr));
}
diff --git a/libcxx/test/std/utilities/optional/optional.hash/hash.pass.cpp b/libcxx/test/std/utilities/optional/optional.hash/hash.pass.cpp
index ea89dc3bd92..8f94d6be653 100644
--- a/libcxx/test/std/utilities/optional/optional.hash/hash.pass.cpp
+++ b/libcxx/test/std/utilities/optional/optional.hash/hash.pass.cpp
@@ -36,6 +36,7 @@ int main()
{
typedef int T;
optional<T> opt;
+ ASSERT_NOT_NOEXCEPT(std::hash<optional<T>>()(opt));
assert(std::hash<optional<T>>{}(opt) == nullopt_hash);
opt = 2;
assert(std::hash<optional<T>>{}(opt) == std::hash<T>{}(*opt));
@@ -43,6 +44,7 @@ int main()
{
typedef std::string T;
optional<T> opt;
+ ASSERT_NOT_NOEXCEPT(std::hash<optional<T>>()(opt));
assert(std::hash<optional<T>>{}(opt) == nullopt_hash);
opt = std::string("123");
assert(std::hash<optional<T>>{}(opt) == std::hash<T>{}(*opt));
@@ -50,6 +52,7 @@ int main()
{
typedef std::unique_ptr<int> T;
optional<T> opt;
+ ASSERT_NOT_NOEXCEPT(std::hash<optional<T>>()(opt));
assert(std::hash<optional<T>>{}(opt) == nullopt_hash);
opt = std::unique_ptr<int>(new int(3));
assert(std::hash<optional<T>>{}(opt) == std::hash<T>{}(*opt));
diff --git a/libcxx/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp b/libcxx/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp
index bc65078911b..8eab082cf67 100644
--- a/libcxx/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp
+++ b/libcxx/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp
@@ -30,6 +30,8 @@ test()
typedef std::hash<T> H;
static_assert((std::is_same<typename H::argument_type, T>::value), "" );
static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
+ ASSERT_NOEXCEPT(H()(T()));
+
H h;
T bs(static_cast<unsigned long long>(N));
const std::size_t result = h(bs);
diff --git a/libcxx/test/std/utilities/variant/variant.hash/hash.pass.cpp b/libcxx/test/std/utilities/variant/variant.hash/hash.pass.cpp
index 96ef967f6c1..840084fe862 100644
--- a/libcxx/test/std/utilities/variant/variant.hash/hash.pass.cpp
+++ b/libcxx/test/std/utilities/variant/variant.hash/hash.pass.cpp
@@ -102,6 +102,7 @@ void test_hash_monostate() {
assert(h(m1) == h(m2));
{
ASSERT_SAME_TYPE(decltype(h(m1)), std::size_t);
+ ASSERT_NOEXCEPT(h(m1));
static_assert(std::is_copy_constructible<H>::value, "");
}
{
OpenPOWER on IntegriCloud