summaryrefslogtreecommitdiffstats
path: root/libcxx/test/containers/sequences
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2014-07-08 15:19:40 +0000
committerMarshall Clow <mclow.lists@gmail.com>2014-07-08 15:19:40 +0000
commit56cca89fc3aefa73e0da3e5bd10b9c85209a726a (patch)
tree4dfc67300083e87762dda3db2248023219033f29 /libcxx/test/containers/sequences
parentcccdadca45d76ebc5f1a6a7975d3c343295d8113 (diff)
downloadbcm5719-llvm-56cca89fc3aefa73e0da3e5bd10b9c85209a726a.tar.gz
bcm5719-llvm-56cca89fc3aefa73e0da3e5bd10b9c85209a726a.zip
Fix some failing tests for the standard containers. The tests were failing in 32-bit mode because they assumed that std::size_type and make_unsigned<ptrdiff_t>::type were always the same type. No change to libc++, just the tests.
llvm-svn: 212538
Diffstat (limited to 'libcxx/test/containers/sequences')
-rw-r--r--libcxx/test/containers/sequences/deque/deque.capacity/resize_size.pass.cpp2
-rw-r--r--libcxx/test/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp2
-rw-r--r--libcxx/test/containers/sequences/deque/types.pass.cpp3
-rw-r--r--libcxx/test/containers/sequences/forwardlist/types.pass.cpp39
4 files changed, 27 insertions, 19 deletions
diff --git a/libcxx/test/containers/sequences/deque/deque.capacity/resize_size.pass.cpp b/libcxx/test/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
index 15f49df395e..8f732a06c7c 100644
--- a/libcxx/test/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
+++ b/libcxx/test/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
@@ -43,7 +43,7 @@ void
test(C& c1, int size)
{
typedef typename C::const_iterator CI;
- std::size_t c1_osize = c1.size();
+ typename C::size_type c1_osize = c1.size();
c1.resize(size);
assert(c1.size() == size);
assert(distance(c1.begin(), c1.end()) == c1.size());
diff --git a/libcxx/test/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp b/libcxx/test/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
index 727b5d5d864..1d1522cbcb3 100644
--- a/libcxx/test/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
+++ b/libcxx/test/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
@@ -43,7 +43,7 @@ void
test(C& c1, int size, int x)
{
typedef typename C::const_iterator CI;
- std::size_t c1_osize = c1.size();
+ typename C::size_type c1_osize = c1.size();
c1.resize(size, x);
assert(c1.size() == size);
assert(distance(c1.begin(), c1.end()) == c1.size());
diff --git a/libcxx/test/containers/sequences/deque/types.pass.cpp b/libcxx/test/containers/sequences/deque/types.pass.cpp
index d32b65c9004..da9470d8a6c 100644
--- a/libcxx/test/containers/sequences/deque/types.pass.cpp
+++ b/libcxx/test/containers/sequences/deque/types.pass.cpp
@@ -82,7 +82,8 @@ int main()
static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
static_assert((std::is_same<C::pointer, min_pointer<C::value_type>>::value), "");
static_assert((std::is_same<C::const_pointer, min_pointer<const C::value_type>>::value), "");
- static_assert((std::is_same<C::size_type, std::size_t>::value), "");
+// min_allocator doesn't have a size_type, so one gets synthesized
+ static_assert((std::is_same<C::size_type, std::make_unsigned<C::difference_type>::type>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
#endif
diff --git a/libcxx/test/containers/sequences/forwardlist/types.pass.cpp b/libcxx/test/containers/sequences/forwardlist/types.pass.cpp
index 68cebf978cb..c95548710bc 100644
--- a/libcxx/test/containers/sequences/forwardlist/types.pass.cpp
+++ b/libcxx/test/containers/sequences/forwardlist/types.pass.cpp
@@ -32,22 +32,29 @@
int main()
{
- static_assert((std::is_same<std::forward_list<char>::value_type, char>::value), "");
- static_assert((std::is_same<std::forward_list<char>::allocator_type, std::allocator<char> >::value), "");
- static_assert((std::is_same<std::forward_list<char>::reference, char&>::value), "");
- static_assert((std::is_same<std::forward_list<char>::const_reference, const char&>::value), "");
- static_assert((std::is_same<std::forward_list<char>::pointer, char*>::value), "");
- static_assert((std::is_same<std::forward_list<char>::const_pointer, const char*>::value), "");
- static_assert((std::is_same<std::forward_list<char>::size_type, std::size_t>::value), "");
- static_assert((std::is_same<std::forward_list<char>::difference_type, std::ptrdiff_t>::value), "");
+ {
+ typedef std::forward_list<char> C;
+ static_assert((std::is_same<C::value_type, char>::value), "");
+ static_assert((std::is_same<C::allocator_type, std::allocator<char> >::value), "");
+ static_assert((std::is_same<C::reference, char&>::value), "");
+ static_assert((std::is_same<C::const_reference, const char&>::value), "");
+ static_assert((std::is_same<C::pointer, char*>::value), "");
+ static_assert((std::is_same<C::const_pointer, const char*>::value), "");
+ static_assert((std::is_same<C::size_type, std::size_t>::value), "");
+ static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
+ }
#if __cplusplus >= 201103L
- static_assert((std::is_same<std::forward_list<char, min_allocator<char>>::value_type, char>::value), "");
- static_assert((std::is_same<std::forward_list<char, min_allocator<char>>::allocator_type, min_allocator<char> >::value), "");
- static_assert((std::is_same<std::forward_list<char, min_allocator<char>>::reference, char&>::value), "");
- static_assert((std::is_same<std::forward_list<char, min_allocator<char>>::const_reference, const char&>::value), "");
- static_assert((std::is_same<std::forward_list<char, min_allocator<char>>::pointer, min_pointer<char>>::value), "");
- static_assert((std::is_same<std::forward_list<char, min_allocator<char>>::const_pointer, min_pointer<const char>>::value), "");
- static_assert((std::is_same<std::forward_list<char, min_allocator<char>>::size_type, std::size_t>::value), "");
- static_assert((std::is_same<std::forward_list<char, min_allocator<char>>::difference_type, std::ptrdiff_t>::value), "");
+ {
+ typedef std::forward_list<char, min_allocator<char>> C;
+ static_assert((std::is_same<C::value_type, char>::value), "");
+ static_assert((std::is_same<C::allocator_type, min_allocator<char> >::value), "");
+ static_assert((std::is_same<C::reference, char&>::value), "");
+ static_assert((std::is_same<C::const_reference, const char&>::value), "");
+ static_assert((std::is_same<C::pointer, min_pointer<char>>::value), "");
+ static_assert((std::is_same<C::const_pointer, min_pointer<const char>>::value), "");
+// min_allocator doesn't have a size_type, so one gets synthesized
+ static_assert((std::is_same<C::size_type, std::make_unsigned<C::difference_type>::type>::value), "");
+ static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
+ }
#endif
}
OpenPOWER on IntegriCloud