summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2015-01-07 21:53:23 +0000
committerMarshall Clow <mclow.lists@gmail.com>2015-01-07 21:53:23 +0000
commitd95510ebba10e0d3e2d0adf352dfa5cae87b0756 (patch)
tree4be77b10cb51f633c7b6eb7878e9ce4af59ff0ee /libcxx/test/std
parent601fa8d824de4cc2cbc42c422b25fbdfe3b7dd32 (diff)
downloadbcm5719-llvm-d95510ebba10e0d3e2d0adf352dfa5cae87b0756.tar.gz
bcm5719-llvm-d95510ebba10e0d3e2d0adf352dfa5cae87b0756.zip
libc++ implements its' hash objects as deriving from std::unary_function, and the tests test for that. STL @ MS pointed out that the standard doesn't requie these objects to derive from unary_function, and so the tests should not require that either. Change the tests to check for the embedded typedefs - which ARE required. No change to the library.
llvm-svn: 225403
Diffstat (limited to 'libcxx/test/std')
-rw-r--r--libcxx/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp5
-rw-r--r--libcxx/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp4
-rw-r--r--libcxx/test/std/experimental/string.view/string.view.hash/string_view.pass.cpp4
-rw-r--r--libcxx/test/std/strings/basic.string.hash/strings.pass.cpp4
-rw-r--r--libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp2
-rw-r--r--libcxx/test/std/utilities/function.objects/unord.hash/enum.pass.cpp7
-rw-r--r--libcxx/test/std/utilities/function.objects/unord.hash/floating.pass.cpp8
-rw-r--r--libcxx/test/std/utilities/function.objects/unord.hash/integral.pass.cpp8
-rw-r--r--libcxx/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp8
-rw-r--r--libcxx/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp4
-rw-r--r--libcxx/test/std/utilities/type.index/type.index.synopsis/hash_type_index.pass.cpp5
11 files changed, 35 insertions, 24 deletions
diff --git a/libcxx/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp
index ea2262cd9c1..a78f4fd590b 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp
@@ -29,8 +29,9 @@ int main()
{
typedef std::vector<bool> T;
typedef std::hash<T> H;
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- H>::value), "");
+ static_assert((std::is_same<H::argument_type, T>::value), "" );
+ static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
+
bool ba[] = {true, false, true, true, false};
T vb(std::begin(ba), std::end(ba));
H h;
diff --git a/libcxx/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp
index 14d7b2d47ae..b812e364bbc 100644
--- a/libcxx/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp
+++ b/libcxx/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp
@@ -27,8 +27,8 @@ test(int i)
{
typedef std::error_code T;
typedef std::hash<T> H;
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- H>::value), "");
+ static_assert((std::is_same<H::argument_type, T>::value), "" );
+ static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
H h;
T ec(i, std::system_category());
assert(h(ec) == i);
diff --git a/libcxx/test/std/experimental/string.view/string.view.hash/string_view.pass.cpp b/libcxx/test/std/experimental/string.view/string.view.hash/string_view.pass.cpp
index 03e0db2dba0..6b16971bfeb 100644
--- a/libcxx/test/std/experimental/string.view/string.view.hash/string_view.pass.cpp
+++ b/libcxx/test/std/experimental/string.view/string.view.hash/string_view.pass.cpp
@@ -29,8 +29,8 @@ void
test()
{
typedef std::hash<T> H;
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- H>::value), "");
+ static_assert((std::is_same<typename H::argument_type, T>::value), "" );
+ static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
H h;
// std::string g1 = "1234567890";
// std::string g2 = "1234567891";
diff --git a/libcxx/test/std/strings/basic.string.hash/strings.pass.cpp b/libcxx/test/std/strings/basic.string.hash/strings.pass.cpp
index 8ba166fbbf2..5fc32c06a70 100644
--- a/libcxx/test/std/strings/basic.string.hash/strings.pass.cpp
+++ b/libcxx/test/std/strings/basic.string.hash/strings.pass.cpp
@@ -27,8 +27,8 @@ void
test()
{
typedef std::hash<T> H;
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- H>::value), "");
+ static_assert((std::is_same<typename H::argument_type, T>::value), "" );
+ static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
H h;
std::string g1 = "1234567890";
std::string g2 = "1234567891";
diff --git a/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp b/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp
index bb7f2aa0dc2..106c69e2e4a 100644
--- a/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp
+++ b/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp
@@ -28,6 +28,8 @@ int main()
std::thread::id id1;
std::thread::id id2 = std::this_thread::get_id();
typedef std::hash<std::thread::id> H;
+ static_assert((std::is_same<typename H::argument_type, std::thread::id>::value), "" );
+ static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
H h;
assert(h(id1) != h(id2));
}
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 b5cd6f8454d..4dbd7b0d810 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
@@ -33,11 +33,12 @@ template <class T>
void
test()
{
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- std::hash<T> >::value), "");
+ typedef std::hash<T> H;
+ static_assert((std::is_same<H::argument_type, T>::value), "" );
+ static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
typedef typename std::underlying_type<T>::type under_type;
- std::hash<T> h1;
+ H h1;
std::hash<under_type> h2;
for (int i = 0; i <= 5; ++i)
{
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 988950d4dc9..f1f198f2359 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
@@ -28,9 +28,11 @@ template <class T>
void
test()
{
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- std::hash<T> >::value), "");
- std::hash<T> h;
+ 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), "" );
+ H h;
+
std::size_t t0 = h(0.);
std::size_t tn0 = h(-0.);
std::size_t tp1 = h(0.1);
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 e5f7ca61624..7cd9f15e93d 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
@@ -27,9 +27,11 @@ template <class T>
void
test()
{
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- std::hash<T> >::value), "");
- std::hash<T> h;
+ 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), "" );
+ H h;
+
for (int i = 0; i <= 5; ++i)
{
T t(i);
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 e4e011295c9..a48394495e2 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
@@ -27,9 +27,11 @@ template <class T>
void
test()
{
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- std::hash<T> >::value), "");
- std::hash<T> h;
+ 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), "" );
+ H h;
+
typedef typename std::remove_pointer<T>::type type;
type i;
type j;
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 b1b24f96f90..520f2e8757c 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
@@ -28,8 +28,8 @@ test()
{
typedef std::bitset<N> T;
typedef std::hash<T> H;
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- H>::value), "");
+ static_assert((std::is_same<typename H::argument_type, T>::value), "" );
+ static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
H h;
T bs(static_cast<unsigned long long>(N));
assert(h(bs) == N);
diff --git a/libcxx/test/std/utilities/type.index/type.index.synopsis/hash_type_index.pass.cpp b/libcxx/test/std/utilities/type.index/type.index.synopsis/hash_type_index.pass.cpp
index b855d125451..6d353f1d305 100644
--- a/libcxx/test/std/utilities/type.index/type.index.synopsis/hash_type_index.pass.cpp
+++ b/libcxx/test/std/utilities/type.index/type.index.synopsis/hash_type_index.pass.cpp
@@ -20,6 +20,7 @@
int main()
{
- static_assert((std::is_base_of<std::unary_function<std::type_index, std::size_t>,
- std::hash<std::type_index> >::value), "");
+ typedef std::hash<std::type_index> H;
+ static_assert((std::is_same<typename H::argument_type, std::type_index>::value), "" );
+ static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
}
OpenPOWER on IntegriCloud