diff options
Diffstat (limited to 'libcxx/test/containers/sequences/vector.bool')
40 files changed, 0 insertions, 2419 deletions
diff --git a/libcxx/test/containers/sequences/vector.bool/assign_copy.pass.cpp b/libcxx/test/containers/sequences/vector.bool/assign_copy.pass.cpp deleted file mode 100644 index 9501799ae3d..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/assign_copy.pass.cpp +++ /dev/null @@ -1,44 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// vector& operator=(const vector& c); - -#include <vector> -#include <cassert> -#include "test_allocator.h" -#include "min_allocator.h" - -int main() -{ - { - std::vector<bool, test_allocator<bool> > l(3, 2, test_allocator<bool>(5)); - std::vector<bool, test_allocator<bool> > l2(l, test_allocator<bool>(3)); - l2 = l; - assert(l2 == l); - assert(l2.get_allocator() == test_allocator<bool>(3)); - } - { - std::vector<bool, other_allocator<bool> > l(3, 2, other_allocator<bool>(5)); - std::vector<bool, other_allocator<bool> > l2(l, other_allocator<bool>(3)); - l2 = l; - assert(l2 == l); - assert(l2.get_allocator() == other_allocator<bool>(5)); - } -#if __cplusplus >= 201103L - { - std::vector<bool, min_allocator<bool> > l(3, 2, min_allocator<bool>()); - std::vector<bool, min_allocator<bool> > l2(l, min_allocator<bool>()); - l2 = l; - assert(l2 == l); - assert(l2.get_allocator() == min_allocator<bool>()); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/assign_initializer_list.pass.cpp b/libcxx/test/containers/sequences/vector.bool/assign_initializer_list.pass.cpp deleted file mode 100644 index 2925fbc6674..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/assign_initializer_list.pass.cpp +++ /dev/null @@ -1,43 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// void assign(initializer_list<value_type> il); - -#include <vector> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - { - std::vector<bool> d; - d.assign({true, false, false, true}); - assert(d.size() == 4); - assert(d[0] == true); - assert(d[1] == false); - assert(d[2] == false); - assert(d[3] == true); - } -#if __cplusplus >= 201103L - { - std::vector<bool, min_allocator<bool>> d; - d.assign({true, false, false, true}); - assert(d.size() == 4); - assert(d[0] == true); - assert(d[1] == false); - assert(d[2] == false); - assert(d[3] == true); - } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -} diff --git a/libcxx/test/containers/sequences/vector.bool/assign_move.pass.cpp b/libcxx/test/containers/sequences/vector.bool/assign_move.pass.cpp deleted file mode 100644 index df98c817fd5..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/assign_move.pass.cpp +++ /dev/null @@ -1,81 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// vector& operator=(vector&& c); - -#include <vector> -#include <cassert> -#include "test_allocator.h" -#include "min_allocator.h" - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - std::vector<bool, test_allocator<bool> > l(test_allocator<bool>(5)); - std::vector<bool, test_allocator<bool> > lo(test_allocator<bool>(5)); - for (int i = 1; i <= 3; ++i) - { - l.push_back(i); - lo.push_back(i); - } - std::vector<bool, test_allocator<bool> > l2(test_allocator<bool>(5)); - l2 = std::move(l); - assert(l2 == lo); - assert(l.empty()); - assert(l2.get_allocator() == lo.get_allocator()); - } - { - std::vector<bool, test_allocator<bool> > l(test_allocator<bool>(5)); - std::vector<bool, test_allocator<bool> > lo(test_allocator<bool>(5)); - for (int i = 1; i <= 3; ++i) - { - l.push_back(i); - lo.push_back(i); - } - std::vector<bool, test_allocator<bool> > l2(test_allocator<bool>(6)); - l2 = std::move(l); - assert(l2 == lo); - assert(!l.empty()); - assert(l2.get_allocator() == test_allocator<bool>(6)); - } - { - std::vector<bool, other_allocator<bool> > l(other_allocator<bool>(5)); - std::vector<bool, other_allocator<bool> > lo(other_allocator<bool>(5)); - for (int i = 1; i <= 3; ++i) - { - l.push_back(i); - lo.push_back(i); - } - std::vector<bool, other_allocator<bool> > l2(other_allocator<bool>(6)); - l2 = std::move(l); - assert(l2 == lo); - assert(l.empty()); - assert(l2.get_allocator() == lo.get_allocator()); - } -#if __cplusplus >= 201103L - { - std::vector<bool, min_allocator<bool> > l(min_allocator<bool>{}); - std::vector<bool, min_allocator<bool> > lo(min_allocator<bool>{}); - for (int i = 1; i <= 3; ++i) - { - l.push_back(i); - lo.push_back(i); - } - std::vector<bool, min_allocator<bool> > l2(min_allocator<bool>{}); - l2 = std::move(l); - assert(l2 == lo); - assert(l.empty()); - assert(l2.get_allocator() == lo.get_allocator()); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/libcxx/test/containers/sequences/vector.bool/capacity.pass.cpp b/libcxx/test/containers/sequences/vector.bool/capacity.pass.cpp deleted file mode 100644 index 63bff25f9f9..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/capacity.pass.cpp +++ /dev/null @@ -1,44 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> -// vector<bool> - -// size_type capacity() const; - -#include <vector> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - { - std::vector<bool> v; - assert(v.capacity() == 0); - } - { - std::vector<bool> v(100); - assert(v.capacity() >= 100); - v.push_back(0); - assert(v.capacity() >= 101); - } -#if __cplusplus >= 201103L - { - std::vector<bool, min_allocator<bool>> v; - assert(v.capacity() == 0); - } - { - std::vector<bool, min_allocator<bool>> v(100); - assert(v.capacity() >= 100); - v.push_back(0); - assert(v.capacity() >= 101); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/construct_default.pass.cpp b/libcxx/test/containers/sequences/vector.bool/construct_default.pass.cpp deleted file mode 100644 index d3d6670bbf2..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/construct_default.pass.cpp +++ /dev/null @@ -1,59 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> -// vector<bool> - -// vector(const Alloc& = Alloc()); - -#include <vector> -#include <cassert> - -#include "test_allocator.h" -#include "min_allocator.h" - -template <class C> -void -test0() -{ - C c; - assert(c.__invariants()); - assert(c.empty()); - assert(c.get_allocator() == typename C::allocator_type()); -#if __cplusplus >= 201103L - C c1 = {}; - assert(c1.__invariants()); - assert(c1.empty()); - assert(c1.get_allocator() == typename C::allocator_type()); -#endif -} - -template <class C> -void -test1(const typename C::allocator_type& a) -{ - C c(a); - assert(c.__invariants()); - assert(c.empty()); - assert(c.get_allocator() == a); -} - -int main() -{ - { - test0<std::vector<bool> >(); - test1<std::vector<bool, test_allocator<bool> > >(test_allocator<bool>(3)); - } -#if __cplusplus >= 201103L - { - test0<std::vector<bool, min_allocator<bool>> >(); - test1<std::vector<bool, min_allocator<bool> > >(min_allocator<bool>()); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/construct_iter_iter.pass.cpp b/libcxx/test/containers/sequences/vector.bool/construct_iter_iter.pass.cpp deleted file mode 100644 index 94e6801825d..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/construct_iter_iter.pass.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> -// vector<bool> - -// template <class InputIter> vector(InputIter first, InputIter last); - -#include <vector> -#include <cassert> - -#include "test_iterators.h" -#include "min_allocator.h" - -template <class C, class Iterator> -void -test(Iterator first, Iterator last) -{ - C c(first, last); - assert(c.__invariants()); - assert(c.size() == std::distance(first, last)); - for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first) - assert(*i == *first); -} - -int main() -{ - bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0}; - bool* an = a + sizeof(a)/sizeof(a[0]); - test<std::vector<bool> >(input_iterator<const bool*>(a), input_iterator<const bool*>(an)); - test<std::vector<bool> >(forward_iterator<const bool*>(a), forward_iterator<const bool*>(an)); - test<std::vector<bool> >(bidirectional_iterator<const bool*>(a), bidirectional_iterator<const bool*>(an)); - test<std::vector<bool> >(random_access_iterator<const bool*>(a), random_access_iterator<const bool*>(an)); - test<std::vector<bool> >(a, an); -#if __cplusplus >= 201103L - test<std::vector<bool, min_allocator<bool>> >(input_iterator<const bool*>(a), input_iterator<const bool*>(an)); - test<std::vector<bool, min_allocator<bool>> >(forward_iterator<const bool*>(a), forward_iterator<const bool*>(an)); - test<std::vector<bool, min_allocator<bool>> >(bidirectional_iterator<const bool*>(a), bidirectional_iterator<const bool*>(an)); - test<std::vector<bool, min_allocator<bool>> >(random_access_iterator<const bool*>(a), random_access_iterator<const bool*>(an)); - test<std::vector<bool, min_allocator<bool>> >(a, an); -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp b/libcxx/test/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp deleted file mode 100644 index ea9d41d342f..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp +++ /dev/null @@ -1,55 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> -// vector<bool> - -// template <class InputIter> vector(InputIter first, InputIter last, -// const allocator_type& a); - -#include <vector> -#include <cassert> - -#include "test_iterators.h" -#include "min_allocator.h" - -template <class C, class Iterator> -void -test(Iterator first, Iterator last, const typename C::allocator_type& a) -{ - C c(first, last, a); - assert(c.__invariants()); - assert(c.size() == std::distance(first, last)); - for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first) - assert(*i == *first); -} - -int main() -{ - bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0}; - bool* an = a + sizeof(a)/sizeof(a[0]); - { - std::allocator<bool> alloc; - test<std::vector<bool> >(input_iterator<const bool*>(a), input_iterator<const bool*>(an), alloc); - test<std::vector<bool> >(forward_iterator<const bool*>(a), forward_iterator<const bool*>(an), alloc); - test<std::vector<bool> >(bidirectional_iterator<const bool*>(a), bidirectional_iterator<const bool*>(an), alloc); - test<std::vector<bool> >(random_access_iterator<const bool*>(a), random_access_iterator<const bool*>(an), alloc); - test<std::vector<bool> >(a, an, alloc); - } -#if __cplusplus >= 201103L - { - min_allocator<bool> alloc; - test<std::vector<bool, min_allocator<bool>> >(input_iterator<const bool*>(a), input_iterator<const bool*>(an), alloc); - test<std::vector<bool, min_allocator<bool>> >(forward_iterator<const bool*>(a), forward_iterator<const bool*>(an), alloc); - test<std::vector<bool, min_allocator<bool>> >(bidirectional_iterator<const bool*>(a), bidirectional_iterator<const bool*>(an), alloc); - test<std::vector<bool, min_allocator<bool>> >(random_access_iterator<const bool*>(a), random_access_iterator<const bool*>(an), alloc); - test<std::vector<bool, min_allocator<bool>> >(a, an, alloc); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/construct_size.pass.cpp b/libcxx/test/containers/sequences/vector.bool/construct_size.pass.cpp deleted file mode 100644 index 93ecbe87c38..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/construct_size.pass.cpp +++ /dev/null @@ -1,64 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> -// vector<bool> - -// explicit vector(size_type n); - -#include <vector> -#include <cassert> - -#include "min_allocator.h" -#include "test_allocator.h" - -template <class C> -void -test2(typename C::size_type n, typename C::allocator_type const& a = typename C::allocator_type ()) -{ -#if _LIBCPP_STD_VER > 11 - C c(n, a); - assert(c.__invariants()); - assert(c.size() == n); - assert(c.get_allocator() == a); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i) - assert(*i == typename C::value_type()); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#endif -} - -template <class C> -void -test1(typename C::size_type n) -{ - C c(n); - assert(c.__invariants()); - assert(c.size() == n); - assert(c.get_allocator() == typename C::allocator_type()); - for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i) - assert(*i == typename C::value_type()); -} - -template <class C> -void -test(typename C::size_type n) -{ - test1<C> ( n ); - test2<C> ( n ); -} - -int main() -{ - test<std::vector<bool> >(50); -#if __cplusplus >= 201103L - test<std::vector<bool, min_allocator<bool>> >(50); - test2<std::vector<bool, test_allocator<bool>> >( 100, test_allocator<bool>(23)); -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/construct_size_value.pass.cpp b/libcxx/test/containers/sequences/vector.bool/construct_size_value.pass.cpp deleted file mode 100644 index fc772f10dfc..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/construct_size_value.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> -// vector<bool> - -// vector(size_type n, const value_type& x); - -#include <vector> -#include <cassert> - -#include "min_allocator.h" - -template <class C> -void -test(typename C::size_type n, const typename C::value_type& x) -{ - C c(n, x); - assert(c.__invariants()); - assert(c.size() == n); - for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i) - assert(*i == x); -} - -int main() -{ - test<std::vector<bool> >(50, 3); -#if __cplusplus >= 201103L - test<std::vector<bool, min_allocator<bool>> >(50, 3); -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/construct_size_value_alloc.pass.cpp b/libcxx/test/containers/sequences/vector.bool/construct_size_value_alloc.pass.cpp deleted file mode 100644 index 6cca948ed83..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/construct_size_value_alloc.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> -// vector<bool> - -// vector(size_type n, const value_type& x, const allocator_type& a); - -#include <vector> -#include <cassert> - -#include "min_allocator.h" - -template <class C> -void -test(typename C::size_type n, const typename C::value_type& x, - const typename C::allocator_type& a) -{ - C c(n, x, a); - assert(c.__invariants()); - assert(a == c.get_allocator()); - assert(c.size() == n); - for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i) - assert(*i == x); -} - -int main() -{ - test<std::vector<bool> >(50, 3, std::allocator<bool>()); -#if __cplusplus >= 201103L - test<std::vector<bool, min_allocator<bool>> >(50, 3, min_allocator<bool>()); -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/copy.pass.cpp b/libcxx/test/containers/sequences/vector.bool/copy.pass.cpp deleted file mode 100644 index 58822782ff8..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/copy.pass.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> -// vector<bool> - -// vector(const vector& v); - -#include <vector> -#include <cassert> -#include "test_allocator.h" -#include "min_allocator.h" - -template <class C> -void -test(const C& x) -{ - unsigned s = x.size(); - C c(x); - assert(c.__invariants()); - assert(c.size() == s); - assert(c == x); -} - -int main() -{ - { - bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0}; - bool* an = a + sizeof(a)/sizeof(a[0]); - test(std::vector<bool>(a, an)); - } - { - std::vector<bool, test_allocator<bool> > v(3, 2, test_allocator<bool>(5)); - std::vector<bool, test_allocator<bool> > v2 = v; - assert(v2 == v); - assert(v2.get_allocator() == v.get_allocator()); - } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE - { - std::vector<bool, other_allocator<bool> > v(3, 2, other_allocator<bool>(5)); - std::vector<bool, other_allocator<bool> > v2 = v; - assert(v2 == v); - assert(v2.get_allocator() == other_allocator<bool>(-2)); - } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE -#if __cplusplus >= 201103L - { - bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0}; - bool* an = a + sizeof(a)/sizeof(a[0]); - test(std::vector<bool, min_allocator<bool>>(a, an)); - } - { - std::vector<bool, min_allocator<bool> > v(3, 2, min_allocator<bool>()); - std::vector<bool, min_allocator<bool> > v2 = v; - assert(v2 == v); - assert(v2.get_allocator() == v.get_allocator()); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/copy_alloc.pass.cpp b/libcxx/test/containers/sequences/vector.bool/copy_alloc.pass.cpp deleted file mode 100644 index 2f0192b995a..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/copy_alloc.pass.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// vector(const vector& v, const allocator_type& a); - -#include <vector> -#include <cassert> -#include "test_allocator.h" -#include "min_allocator.h" - -template <class C> -void -test(const C& x, const typename C::allocator_type& a) -{ - unsigned s = x.size(); - C c(x, a); - assert(c.__invariants()); - assert(c.size() == s); - assert(c == x); -} - -int main() -{ - { - int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0}; - int* an = a + sizeof(a)/sizeof(a[0]); - test(std::vector<bool>(a, an), std::allocator<bool>()); - } - { - std::vector<bool, test_allocator<bool> > l(3, 2, test_allocator<bool>(5)); - std::vector<bool, test_allocator<bool> > l2(l, test_allocator<bool>(3)); - assert(l2 == l); - assert(l2.get_allocator() == test_allocator<bool>(3)); - } - { - std::vector<bool, other_allocator<bool> > l(3, 2, other_allocator<bool>(5)); - std::vector<bool, other_allocator<bool> > l2(l, other_allocator<bool>(3)); - assert(l2 == l); - assert(l2.get_allocator() == other_allocator<bool>(3)); - } -#if __cplusplus >= 201103L - { - int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0}; - int* an = a + sizeof(a)/sizeof(a[0]); - test(std::vector<bool, min_allocator<bool>>(a, an), min_allocator<bool>()); - } - { - std::vector<bool, min_allocator<bool> > l(3, 2, min_allocator<bool>()); - std::vector<bool, min_allocator<bool> > l2(l, min_allocator<bool>()); - assert(l2 == l); - assert(l2.get_allocator() == min_allocator<bool>()); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/default_noexcept.pass.cpp b/libcxx/test/containers/sequences/vector.bool/default_noexcept.pass.cpp deleted file mode 100644 index b94588ead93..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/default_noexcept.pass.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// vector<bool>() -// noexcept(is_nothrow_default_constructible<allocator_type>::value); - -// This tests a conforming extension - -#include <vector> -#include <cassert> - -#include "test_allocator.h" - -template <class T> -struct some_alloc -{ - typedef T value_type; - some_alloc(const some_alloc&); -}; - -int main() -{ -#if __has_feature(cxx_noexcept) - { - typedef std::vector<bool> C; - static_assert(std::is_nothrow_default_constructible<C>::value, ""); - } - { - typedef std::vector<bool, test_allocator<bool>> C; - static_assert(std::is_nothrow_default_constructible<C>::value, ""); - } - { - typedef std::vector<bool, other_allocator<bool>> C; - static_assert(!std::is_nothrow_default_constructible<C>::value, ""); - } - { - typedef std::vector<bool, some_alloc<bool>> C; - static_assert(!std::is_nothrow_default_constructible<C>::value, ""); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/dtor_noexcept.pass.cpp b/libcxx/test/containers/sequences/vector.bool/dtor_noexcept.pass.cpp deleted file mode 100644 index 682e74ef03c..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/dtor_noexcept.pass.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// ~vector<bool>() // implied noexcept; - -#include <vector> -#include <cassert> - -#include "test_allocator.h" - -#if __has_feature(cxx_noexcept) - -template <class T> -struct some_alloc -{ - typedef T value_type; - some_alloc(const some_alloc&); - ~some_alloc() noexcept(false); -}; - -#endif - -int main() -{ -#if __has_feature(cxx_noexcept) - { - typedef std::vector<bool> C; - static_assert(std::is_nothrow_destructible<C>::value, ""); - } - { - typedef std::vector<bool, test_allocator<bool>> C; - static_assert(std::is_nothrow_destructible<C>::value, ""); - } - { - typedef std::vector<bool, other_allocator<bool>> C; - static_assert(std::is_nothrow_destructible<C>::value, ""); - } - { - typedef std::vector<bool, some_alloc<bool>> C; - static_assert(!std::is_nothrow_destructible<C>::value, ""); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/emplace.pass.cpp b/libcxx/test/containers/sequences/vector.bool/emplace.pass.cpp deleted file mode 100644 index f3fd1e9926f..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/emplace.pass.cpp +++ /dev/null @@ -1,68 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> -// vector<bool> - -// template <class... Args> iterator emplace(const_iterator pos, Args&&... args); - -#include <vector> -#include <cassert> -#include "min_allocator.h" - -int main() -{ -#if _LIBCPP_STD_VER > 11 - { - typedef std::vector<bool> C; - C c; - - C::iterator i = c.emplace(c.cbegin()); - assert(i == c.begin()); - assert(c.size() == 1); - assert(c.front() == false); - - i = c.emplace(c.cend(), true); - assert(i == c.end()-1); - assert(c.size() == 2); - assert(c.front() == false); - assert(c.back() == true); - - i = c.emplace(c.cbegin()+1, 1 == 1); - assert(i == c.begin()+1); - assert(c.size() == 3); - assert(c.front() == false); - assert(c[1] == true); - assert(c.back() == true); - } - { - typedef std::vector<bool, min_allocator<bool>> C; - C c; - - C::iterator i = c.emplace(c.cbegin()); - assert(i == c.begin()); - assert(c.size() == 1); - assert(c.front() == false); - - i = c.emplace(c.cend(), true); - assert(i == c.end()-1); - assert(c.size() == 2); - assert(c.front() == false); - assert(c.back() == true); - - i = c.emplace(c.cbegin()+1, 1 == 1); - assert(i == c.begin()+1); - assert(c.size() == 3); - assert(c.size() == 3); - assert(c.front() == false); - assert(c[1] == true); - assert(c.back() == true); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/emplace_back.pass.cpp b/libcxx/test/containers/sequences/vector.bool/emplace_back.pass.cpp deleted file mode 100644 index 57aa47822f8..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/emplace_back.pass.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> -// vector.bool - -// template <class... Args> void emplace_back(Args&&... args); - -#include <vector> -#include <cassert> -#include "min_allocator.h" - - -int main() -{ -#if _LIBCPP_STD_VER > 11 - { - typedef std::vector<bool> C; - C c; - c.emplace_back(); - assert(c.size() == 1); - assert(c.front() == false); - c.emplace_back(true); - assert(c.size() == 2); - assert(c.front() == false); - assert(c.back() == true); - c.emplace_back(1 == 1); - assert(c.size() == 3); - assert(c.front() == false); - assert(c[1] == true); - assert(c.back() == true); - } - { - typedef std::vector<bool, min_allocator<bool>> C; - C c; - - c.emplace_back(); - assert(c.size() == 1); - assert(c.front() == false); - c.emplace_back(true); - assert(c.size() == 2); - assert(c.front() == false); - assert(c.back() == true); - c.emplace_back(1 == 1); - assert(c.size() == 3); - assert(c.front() == false); - assert(c[1] == true); - assert(c.back() == true); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/erase_iter.pass.cpp b/libcxx/test/containers/sequences/vector.bool/erase_iter.pass.cpp deleted file mode 100644 index cbf26dd570a..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/erase_iter.pass.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> -// vector<bool> - -// iterator erase(const_iterator position); - -#include <vector> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - bool a1[] = {1, 0, 1}; - { - std::vector<bool> l1(a1, a1+3); - std::vector<bool>::const_iterator i = l1.begin(); - ++i; - std::vector<bool>::iterator j = l1.erase(i); - assert(l1.size() == 2); - assert(distance(l1.begin(), l1.end()) == 2); - assert(*j == true); - assert(*l1.begin() == 1); - assert(*next(l1.begin()) == true); - j = l1.erase(j); - assert(j == l1.end()); - assert(l1.size() == 1); - assert(distance(l1.begin(), l1.end()) == 1); - assert(*l1.begin() == true); - j = l1.erase(l1.begin()); - assert(j == l1.end()); - assert(l1.size() == 0); - assert(distance(l1.begin(), l1.end()) == 0); - } -#if __cplusplus >= 201103L - { - std::vector<bool, min_allocator<bool>> l1(a1, a1+3); - std::vector<bool, min_allocator<bool>>::const_iterator i = l1.begin(); - ++i; - std::vector<bool, min_allocator<bool>>::iterator j = l1.erase(i); - assert(l1.size() == 2); - assert(distance(l1.begin(), l1.end()) == 2); - assert(*j == true); - assert(*l1.begin() == 1); - assert(*next(l1.begin()) == true); - j = l1.erase(j); - assert(j == l1.end()); - assert(l1.size() == 1); - assert(distance(l1.begin(), l1.end()) == 1); - assert(*l1.begin() == true); - j = l1.erase(l1.begin()); - assert(j == l1.end()); - assert(l1.size() == 0); - assert(distance(l1.begin(), l1.end()) == 0); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/erase_iter_iter.pass.cpp b/libcxx/test/containers/sequences/vector.bool/erase_iter_iter.pass.cpp deleted file mode 100644 index 2c2c4cc4861..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/erase_iter_iter.pass.cpp +++ /dev/null @@ -1,85 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> -// vector<bool> - -// iterator erase(const_iterator first, const_iterator last); - -#include <vector> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - bool a1[] = {1, 0, 1}; - { - std::vector<bool> l1(a1, a1+3); - std::vector<bool>::iterator i = l1.erase(l1.cbegin(), l1.cbegin()); - assert(l1.size() == 3); - assert(distance(l1.cbegin(), l1.cend()) == 3); - assert(i == l1.begin()); - } - { - std::vector<bool> l1(a1, a1+3); - std::vector<bool>::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin())); - assert(l1.size() == 2); - assert(distance(l1.cbegin(), l1.cend()) == 2); - assert(i == l1.begin()); - assert(l1 == std::vector<bool>(a1+1, a1+3)); - } - { - std::vector<bool> l1(a1, a1+3); - std::vector<bool>::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin(), 2)); - assert(l1.size() == 1); - assert(distance(l1.cbegin(), l1.cend()) == 1); - assert(i == l1.begin()); - assert(l1 == std::vector<bool>(a1+2, a1+3)); - } - { - std::vector<bool> l1(a1, a1+3); - std::vector<bool>::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin(), 3)); - assert(l1.size() == 0); - assert(distance(l1.cbegin(), l1.cend()) == 0); - assert(i == l1.begin()); - } -#if __cplusplus >= 201103L - { - std::vector<bool, min_allocator<bool>> l1(a1, a1+3); - std::vector<bool, min_allocator<bool>>::iterator i = l1.erase(l1.cbegin(), l1.cbegin()); - assert(l1.size() == 3); - assert(distance(l1.cbegin(), l1.cend()) == 3); - assert(i == l1.begin()); - } - { - std::vector<bool, min_allocator<bool>> l1(a1, a1+3); - std::vector<bool, min_allocator<bool>>::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin())); - assert(l1.size() == 2); - assert(distance(l1.cbegin(), l1.cend()) == 2); - assert(i == l1.begin()); - assert((l1 == std::vector<bool, min_allocator<bool>>(a1+1, a1+3))); - } - { - std::vector<bool, min_allocator<bool>> l1(a1, a1+3); - std::vector<bool, min_allocator<bool>>::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin(), 2)); - assert(l1.size() == 1); - assert(distance(l1.cbegin(), l1.cend()) == 1); - assert(i == l1.begin()); - assert((l1 == std::vector<bool, min_allocator<bool>>(a1+2, a1+3))); - } - { - std::vector<bool, min_allocator<bool>> l1(a1, a1+3); - std::vector<bool, min_allocator<bool>>::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin(), 3)); - assert(l1.size() == 0); - assert(distance(l1.cbegin(), l1.cend()) == 0); - assert(i == l1.begin()); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/find.pass.cpp b/libcxx/test/containers/sequences/vector.bool/find.pass.cpp deleted file mode 100644 index 75567a9b7bb..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/find.pass.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> -// vector<bool> - -// std::find with vector<bool>::iterator - -// http://llvm.org/bugs/show_bug.cgi?id=16816 - -#include <vector> -#include <cassert> - -int main() -{ - { - for (unsigned i = 1; i < 256; ++i) - { - std::vector<bool> b(i,true); - std::vector<bool>::iterator j = std::find(b.begin()+1, b.end(), false); - assert(j-b.begin() == i); - assert(b.end() == j); - } - } - { - for (unsigned i = 1; i < 256; ++i) - { - std::vector<bool> b(i,false); - std::vector<bool>::iterator j = std::find(b.begin()+1, b.end(), true); - assert(j-b.begin() == i); - assert(b.end() == j); - } - } -} diff --git a/libcxx/test/containers/sequences/vector.bool/initializer_list.pass.cpp b/libcxx/test/containers/sequences/vector.bool/initializer_list.pass.cpp deleted file mode 100644 index b9b46865449..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/initializer_list.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// vector(initializer_list<value_type> il); - -#include <vector> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - { - std::vector<bool> d = {true, false, false, true}; - assert(d.size() == 4); - assert(d[0] == true); - assert(d[1] == false); - assert(d[2] == false); - assert(d[3] == true); - } -#if __cplusplus >= 201103L - { - std::vector<bool, min_allocator<bool>> d = {true, false, false, true}; - assert(d.size() == 4); - assert(d[0] == true); - assert(d[1] == false); - assert(d[2] == false); - assert(d[3] == true); - } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -} diff --git a/libcxx/test/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp b/libcxx/test/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp deleted file mode 100644 index aea3ad763cd..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp +++ /dev/null @@ -1,44 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// vector(initializer_list<value_type> il, const Allocator& a = allocator_type()); - -#include <vector> -#include <cassert> - -#include "test_allocator.h" -#include "min_allocator.h" - -int main() -{ -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - { - std::vector<bool, test_allocator<bool>> d({true, false, false, true}, test_allocator<bool>(3)); - assert(d.get_allocator() == test_allocator<bool>(3)); - assert(d.size() == 4); - assert(d[0] == true); - assert(d[1] == false); - assert(d[2] == false); - assert(d[3] == true); - } -#if __cplusplus >= 201103L - { - std::vector<bool, min_allocator<bool>> d({true, false, false, true}, min_allocator<bool>()); - assert(d.get_allocator() == min_allocator<bool>()); - assert(d.size() == 4); - assert(d[0] == true); - assert(d[1] == false); - assert(d[2] == false); - assert(d[3] == true); - } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -} diff --git a/libcxx/test/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp b/libcxx/test/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp deleted file mode 100644 index c081cc81c59..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// iterator insert(const_iterator p, initializer_list<value_type> il); - -#include <vector> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - { - std::vector<bool> d(10, true); - std::vector<bool>::iterator i = d.insert(d.cbegin() + 2, {false, true, true, false}); - assert(d.size() == 14); - assert(i == d.begin() + 2); - assert(d[0] == true); - assert(d[1] == true); - assert(d[2] == false); - assert(d[3] == true); - assert(d[4] == true); - assert(d[5] == false); - assert(d[6] == true); - assert(d[7] == true); - assert(d[8] == true); - assert(d[9] == true); - assert(d[10] == true); - assert(d[11] == true); - assert(d[12] == true); - assert(d[13] == true); - } -#if __cplusplus >= 201103L - { - std::vector<bool, min_allocator<bool>> d(10, true); - std::vector<bool, min_allocator<bool>>::iterator i = d.insert(d.cbegin() + 2, {false, true, true, false}); - assert(d.size() == 14); - assert(i == d.begin() + 2); - assert(d[0] == true); - assert(d[1] == true); - assert(d[2] == false); - assert(d[3] == true); - assert(d[4] == true); - assert(d[5] == false); - assert(d[6] == true); - assert(d[7] == true); - assert(d[8] == true); - assert(d[9] == true); - assert(d[10] == true); - assert(d[11] == true); - assert(d[12] == true); - assert(d[13] == true); - } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -} diff --git a/libcxx/test/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp b/libcxx/test/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp deleted file mode 100644 index e51f8b589c7..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp +++ /dev/null @@ -1,126 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> -// vector<bool> - -// template <class Iter> -// iterator insert(const_iterator position, Iter first, Iter last); - -#include <vector> -#include <cassert> -#include "test_iterators.h" -#include "min_allocator.h" - -int main() -{ - { - std::vector<bool> v(100); - bool a[] = {1, 0, 0, 1, 1}; - const unsigned N = sizeof(a)/sizeof(a[0]); - std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, input_iterator<const bool*>(a), - input_iterator<const bool*>(a+N)); - assert(v.size() == 100 + N); - assert(i == v.begin() + 10); - int j; - for (j = 0; j < 10; ++j) - assert(v[j] == 0); - for (int k = 0; k < N; ++j, ++k) - assert(v[j] == a[k]); - for (; j < v.size(); ++j) - assert(v[j] == 0); - } - { - std::vector<bool> v(100); - bool a[] = {1, 0, 0, 1, 1}; - const unsigned N = sizeof(a)/sizeof(a[0]); - std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const bool*>(a), - forward_iterator<const bool*>(a+N)); - assert(v.size() == 100 + N); - assert(i == v.begin() + 10); - int j; - for (j = 0; j < 10; ++j) - assert(v[j] == 0); - for (int k = 0; k < N; ++j, ++k) - assert(v[j] == a[k]); - for (; j < 105; ++j) - assert(v[j] == 0); - } - { - std::vector<bool> v(100); - while(v.size() < v.capacity()) v.push_back(false); - size_t sz = v.size(); - bool a[] = {1, 0, 0, 1, 1}; - const unsigned N = sizeof(a)/sizeof(a[0]); - std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const bool*>(a), - forward_iterator<const bool*>(a+N)); - assert(v.size() == sz + N); - assert(i == v.begin() + 10); - int j; - for (j = 0; j < 10; ++j) - assert(v[j] == 0); - for (int k = 0; k < N; ++j, ++k) - assert(v[j] == a[k]); - for (; j < v.size(); ++j) - assert(v[j] == 0); - } - { - std::vector<bool> v(100); - while(v.size() < v.capacity()) v.push_back(false); - v.pop_back(); v.pop_back(); v.pop_back(); - size_t sz = v.size(); - bool a[] = {1, 0, 0, 1, 1}; - const unsigned N = sizeof(a)/sizeof(a[0]); - std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const bool*>(a), - forward_iterator<const bool*>(a+N)); - assert(v.size() == sz + N); - assert(i == v.begin() + 10); - int j; - for (j = 0; j < 10; ++j) - assert(v[j] == 0); - for (int k = 0; k < N; ++j, ++k) - assert(v[j] == a[k]); - for (; j < v.size(); ++j) - assert(v[j] == 0); - } -#if __cplusplus >= 201103L - { - std::vector<bool, min_allocator<bool>> v(100); - bool a[] = {1, 0, 0, 1, 1}; - const unsigned N = sizeof(a)/sizeof(a[0]); - std::vector<bool, min_allocator<bool>>::iterator i = v.insert(v.cbegin() + 10, input_iterator<const bool*>(a), - input_iterator<const bool*>(a+N)); - assert(v.size() == 100 + N); - assert(i == v.begin() + 10); - int j; - for (j = 0; j < 10; ++j) - assert(v[j] == 0); - for (int k = 0; k < N; ++j, ++k) - assert(v[j] == a[k]); - for (; j < v.size(); ++j) - assert(v[j] == 0); - } - { - std::vector<bool, min_allocator<bool>> v(100); - bool a[] = {1, 0, 0, 1, 1}; - const unsigned N = sizeof(a)/sizeof(a[0]); - std::vector<bool, min_allocator<bool>>::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const bool*>(a), - forward_iterator<const bool*>(a+N)); - assert(v.size() == 100 + N); - assert(i == v.begin() + 10); - int j; - for (j = 0; j < 10; ++j) - assert(v[j] == 0); - for (int k = 0; k < N; ++j, ++k) - assert(v[j] == a[k]); - for (; j < v.size(); ++j) - assert(v[j] == 0); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp b/libcxx/test/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp deleted file mode 100644 index 710ad4885f0..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp +++ /dev/null @@ -1,81 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> -// vector<bool> - -// iterator insert(const_iterator position, size_type n, const value_type& x); - -#include <vector> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - { - std::vector<bool> v(100); - std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 5, 1); - assert(v.size() == 105); - assert(i == v.begin() + 10); - int j; - for (j = 0; j < 10; ++j) - assert(v[j] == 0); - for (; j < 15; ++j) - assert(v[j] == 1); - for (++j; j < v.size(); ++j) - assert(v[j] == 0); - } - { - std::vector<bool> v(100); - while(v.size() < v.capacity()) v.push_back(false); - size_t sz = v.size(); - std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 5, 1); - assert(v.size() == sz + 5); - assert(i == v.begin() + 10); - int j; - for (j = 0; j < 10; ++j) - assert(v[j] == 0); - for (; j < 15; ++j) - assert(v[j] == 1); - for (++j; j < v.size(); ++j) - assert(v[j] == 0); - } - { - std::vector<bool> v(100); - while(v.size() < v.capacity()) v.push_back(false); - v.pop_back(); v.pop_back(); - size_t sz = v.size(); - std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 5, 1); - assert(v.size() == sz + 5); - assert(i == v.begin() + 10); - int j; - for (j = 0; j < 10; ++j) - assert(v[j] == 0); - for (; j < 15; ++j) - assert(v[j] == 1); - for (++j; j < v.size(); ++j) - assert(v[j] == 0); - } -#if __cplusplus >= 201103L - { - std::vector<bool, min_allocator<bool>> v(100); - std::vector<bool, min_allocator<bool>>::iterator i = v.insert(v.cbegin() + 10, 5, 1); - assert(v.size() == 105); - assert(i == v.begin() + 10); - int j; - for (j = 0; j < 10; ++j) - assert(v[j] == 0); - for (; j < 15; ++j) - assert(v[j] == 1); - for (++j; j < v.size(); ++j) - assert(v[j] == 0); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/insert_iter_value.pass.cpp b/libcxx/test/containers/sequences/vector.bool/insert_iter_value.pass.cpp deleted file mode 100644 index 51c4626de0d..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/insert_iter_value.pass.cpp +++ /dev/null @@ -1,77 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> -// vector<bool> - -// iterator insert(const_iterator position, const value_type& x); - -#include <vector> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - { - std::vector<bool> v(100); - std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 1); - assert(v.size() == 101); - assert(i == v.begin() + 10); - int j; - for (j = 0; j < 10; ++j) - assert(v[j] == 0); - assert(v[j] == 1); - for (++j; j < v.size(); ++j) - assert(v[j] == 0); - } - { - std::vector<bool> v(100); - while(v.size() < v.capacity()) v.push_back(false); - size_t sz = v.size(); - std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 1); - assert(v.size() == sz + 1); - assert(i == v.begin() + 10); - int j; - for (j = 0; j < 10; ++j) - assert(v[j] == 0); - assert(v[j] == 1); - for (++j; j < v.size(); ++j) - assert(v[j] == 0); - } - { - std::vector<bool> v(100); - while(v.size() < v.capacity()) v.push_back(false); - v.pop_back(); v.pop_back(); - size_t sz = v.size(); - std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 1); - assert(v.size() == sz + 1); - assert(i == v.begin() + 10); - int j; - for (j = 0; j < 10; ++j) - assert(v[j] == 0); - assert(v[j] == 1); - for (++j; j < v.size(); ++j) - assert(v[j] == 0); - } -#if __cplusplus >= 201103L - { - std::vector<bool, min_allocator<bool>> v(100); - std::vector<bool, min_allocator<bool>>::iterator i = v.insert(v.cbegin() + 10, 1); - assert(v.size() == 101); - assert(i == v.begin() + 10); - int j; - for (j = 0; j < 10; ++j) - assert(v[j] == 0); - assert(v[j] == 1); - for (++j; j < v.size(); ++j) - assert(v[j] == 0); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/iterators.pass.cpp b/libcxx/test/containers/sequences/vector.bool/iterators.pass.cpp deleted file mode 100644 index c54fa4a80a9..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/iterators.pass.cpp +++ /dev/null @@ -1,123 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// iterator begin(); -// iterator end(); -// const_iterator begin() const; -// const_iterator end() const; -// const_iterator cbegin() const; -// const_iterator cend() const; - -#include <vector> -#include <cassert> -#include <iterator> - -#include "min_allocator.h" - -int main() -{ - { - typedef bool T; - typedef std::vector<T> C; - C c; - C::iterator i = c.begin(); - C::iterator j = c.end(); - assert(std::distance(i, j) == 0); - assert(i == j); - } - { - typedef bool T; - typedef std::vector<T> C; - const C c; - C::const_iterator i = c.begin(); - C::const_iterator j = c.end(); - assert(std::distance(i, j) == 0); - assert(i == j); - } - { - typedef bool T; - typedef std::vector<T> C; - C c; - C::const_iterator i = c.cbegin(); - C::const_iterator j = c.cend(); - assert(std::distance(i, j) == 0); - assert(i == j); - assert(i == c.end()); - } - { - typedef bool T; - typedef std::vector<T> C; - C::iterator i; - C::const_iterator j; - } -#if __cplusplus >= 201103L - { - typedef bool T; - typedef std::vector<T, min_allocator<T>> C; - C c; - C::iterator i = c.begin(); - C::iterator j = c.end(); - assert(std::distance(i, j) == 0); - assert(i == j); - } - { - typedef bool T; - typedef std::vector<T, min_allocator<T>> C; - const C c; - C::const_iterator i = c.begin(); - C::const_iterator j = c.end(); - assert(std::distance(i, j) == 0); - assert(i == j); - } - { - typedef bool T; - typedef std::vector<T, min_allocator<T>> C; - C c; - C::const_iterator i = c.cbegin(); - C::const_iterator j = c.cend(); - assert(std::distance(i, j) == 0); - assert(i == j); - assert(i == c.end()); - } - { - typedef bool T; - typedef std::vector<T, min_allocator<T>> C; - C::iterator i; - C::const_iterator j; - } -#endif -#if _LIBCPP_STD_VER > 11 - { // N3644 testing - std::vector<bool>::iterator ii1{}, ii2{}; - std::vector<bool>::iterator ii4 = ii1; - std::vector<bool>::const_iterator cii{}; - assert ( ii1 == ii2 ); - assert ( ii1 == ii4 ); - - assert (!(ii1 != ii2 )); - - assert ( (ii1 == cii )); - assert ( (cii == ii1 )); - assert (!(ii1 != cii )); - assert (!(cii != ii1 )); - assert (!(ii1 < cii )); - assert (!(cii < ii1 )); - assert ( (ii1 <= cii )); - assert ( (cii <= ii1 )); - assert (!(ii1 > cii )); - assert (!(cii > ii1 )); - assert ( (ii1 >= cii )); - assert ( (cii >= ii1 )); - assert (cii - ii1 == 0); - assert (ii1 - cii == 0); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/move.pass.cpp b/libcxx/test/containers/sequences/vector.bool/move.pass.cpp deleted file mode 100644 index e877292ced7..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/move.pass.cpp +++ /dev/null @@ -1,64 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// vector(vector&& c); - -#include <vector> -#include <cassert> -#include "test_allocator.h" -#include "min_allocator.h" - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - std::vector<bool, test_allocator<bool> > l(test_allocator<bool>(5)); - std::vector<bool, test_allocator<bool> > lo(test_allocator<bool>(5)); - for (int i = 1; i <= 3; ++i) - { - l.push_back(i); - lo.push_back(i); - } - std::vector<bool, test_allocator<bool> > l2 = std::move(l); - assert(l2 == lo); - assert(l.empty()); - assert(l2.get_allocator() == lo.get_allocator()); - } - { - std::vector<bool, other_allocator<bool> > l(other_allocator<bool>(5)); - std::vector<bool, other_allocator<bool> > lo(other_allocator<bool>(5)); - for (int i = 1; i <= 3; ++i) - { - l.push_back(i); - lo.push_back(i); - } - std::vector<bool, other_allocator<bool> > l2 = std::move(l); - assert(l2 == lo); - assert(l.empty()); - assert(l2.get_allocator() == lo.get_allocator()); - } -#if __cplusplus >= 201103L - { - std::vector<bool, min_allocator<bool> > l(min_allocator<bool>{}); - std::vector<bool, min_allocator<bool> > lo(min_allocator<bool>{}); - for (int i = 1; i <= 3; ++i) - { - l.push_back(i); - lo.push_back(i); - } - std::vector<bool, min_allocator<bool> > l2 = std::move(l); - assert(l2 == lo); - assert(l.empty()); - assert(l2.get_allocator() == lo.get_allocator()); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/libcxx/test/containers/sequences/vector.bool/move_alloc.pass.cpp b/libcxx/test/containers/sequences/vector.bool/move_alloc.pass.cpp deleted file mode 100644 index deee9326197..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/move_alloc.pass.cpp +++ /dev/null @@ -1,77 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// vector(vector&& c, const allocator_type& a); - -#include <vector> -#include <cassert> -#include "test_allocator.h" -#include "min_allocator.h" - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - std::vector<bool, test_allocator<bool> > l(test_allocator<bool>(5)); - std::vector<bool, test_allocator<bool> > lo(test_allocator<bool>(5)); - for (int i = 1; i <= 3; ++i) - { - l.push_back(i); - lo.push_back(i); - } - std::vector<bool, test_allocator<bool> > l2(std::move(l), test_allocator<bool>(6)); - assert(l2 == lo); - assert(!l.empty()); - assert(l2.get_allocator() == test_allocator<bool>(6)); - } - { - std::vector<bool, test_allocator<bool> > l(test_allocator<bool>(5)); - std::vector<bool, test_allocator<bool> > lo(test_allocator<bool>(5)); - for (int i = 1; i <= 3; ++i) - { - l.push_back(i); - lo.push_back(i); - } - std::vector<bool, test_allocator<bool> > l2(std::move(l), test_allocator<bool>(5)); - assert(l2 == lo); - assert(l.empty()); - assert(l2.get_allocator() == test_allocator<bool>(5)); - } - { - std::vector<bool, other_allocator<bool> > l(other_allocator<bool>(5)); - std::vector<bool, other_allocator<bool> > lo(other_allocator<bool>(5)); - for (int i = 1; i <= 3; ++i) - { - l.push_back(i); - lo.push_back(i); - } - std::vector<bool, other_allocator<bool> > l2(std::move(l), other_allocator<bool>(4)); - assert(l2 == lo); - assert(!l.empty()); - assert(l2.get_allocator() == other_allocator<bool>(4)); - } -#if __cplusplus >= 201103L - { - std::vector<bool, min_allocator<bool> > l(min_allocator<bool>{}); - std::vector<bool, min_allocator<bool> > lo(min_allocator<bool>{}); - for (int i = 1; i <= 3; ++i) - { - l.push_back(i); - lo.push_back(i); - } - std::vector<bool, min_allocator<bool> > l2(std::move(l), min_allocator<bool>()); - assert(l2 == lo); - assert(l.empty()); - assert(l2.get_allocator() == min_allocator<bool>()); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/libcxx/test/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp b/libcxx/test/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp deleted file mode 100644 index b580eb4ae3b..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// vector& operator=(vector&& c) -// noexcept( -// allocator_type::propagate_on_container_move_assignment::value && -// is_nothrow_move_assignable<allocator_type>::value); - -// This tests a conforming extension - -#include <vector> -#include <cassert> - -#include "test_allocator.h" - -template <class T> -struct some_alloc -{ - typedef T value_type; - some_alloc(const some_alloc&); -}; - -int main() -{ -#if __has_feature(cxx_noexcept) - { - typedef std::vector<bool> C; - static_assert(std::is_nothrow_move_assignable<C>::value, ""); - } - { - typedef std::vector<bool, test_allocator<bool>> C; - static_assert(!std::is_nothrow_move_assignable<C>::value, ""); - } - { - typedef std::vector<bool, other_allocator<bool>> C; - static_assert(std::is_nothrow_move_assignable<C>::value, ""); - } - { - typedef std::vector<bool, some_alloc<bool>> C; - static_assert(!std::is_nothrow_move_assignable<C>::value, ""); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/move_noexcept.pass.cpp b/libcxx/test/containers/sequences/vector.bool/move_noexcept.pass.cpp deleted file mode 100644 index ab32bd0677b..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/move_noexcept.pass.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// vector(vector&&) -// noexcept(is_nothrow_move_constructible<allocator_type>::value); - -// This tests a conforming extension - -#include <vector> -#include <cassert> - -#include "test_allocator.h" - -template <class T> -struct some_alloc -{ - typedef T value_type; - some_alloc(const some_alloc&); -}; - -int main() -{ -#if __has_feature(cxx_noexcept) - { - typedef std::vector<bool> C; - static_assert(std::is_nothrow_move_constructible<C>::value, ""); - } - { - typedef std::vector<bool, test_allocator<bool>> C; - static_assert(std::is_nothrow_move_constructible<C>::value, ""); - } - { - typedef std::vector<bool, other_allocator<bool>> C; - static_assert(std::is_nothrow_move_constructible<C>::value, ""); - } - { - typedef std::vector<bool, some_alloc<bool>> C; - static_assert(!std::is_nothrow_move_constructible<C>::value, ""); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp b/libcxx/test/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp deleted file mode 100644 index ef3dc5d1079..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp +++ /dev/null @@ -1,43 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// vector& operator=(initializer_list<value_type> il); - -#include <vector> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - { - std::vector<bool> d; - d = {true, false, false, true}; - assert(d.size() == 4); - assert(d[0] == true); - assert(d[1] == false); - assert(d[2] == false); - assert(d[3] == true); - } -#if __cplusplus >= 201103L - { - std::vector<bool, min_allocator<bool>> d; - d = {true, false, false, true}; - assert(d.size() == 4); - assert(d[0] == true); - assert(d[1] == false); - assert(d[2] == false); - assert(d[3] == true); - } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -} diff --git a/libcxx/test/containers/sequences/vector.bool/push_back.pass.cpp b/libcxx/test/containers/sequences/vector.bool/push_back.pass.cpp deleted file mode 100644 index c6b0fbf4185..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/push_back.pass.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> -// vector<bool> - -// void push_back(const value_type& x); - -#include <vector> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - { - bool a[] = {0, 1, 1, 0, 1, 0, 0}; - const unsigned N = sizeof(a)/sizeof(a[0]); - std::vector<bool> c; - for (unsigned i = 0; i < N; ++i) - { - c.push_back(a[i]); - assert(c.size() == i+1); - for (int j = 0; j < c.size(); ++j) - assert(c[j] == a[j]); - } - } -#if __cplusplus >= 201103L - { - bool a[] = {0, 1, 1, 0, 1, 0, 0}; - const unsigned N = sizeof(a)/sizeof(a[0]); - std::vector<bool, min_allocator<bool>> c; - for (unsigned i = 0; i < N; ++i) - { - c.push_back(a[i]); - assert(c.size() == i+1); - for (int j = 0; j < c.size(); ++j) - assert(c[j] == a[j]); - } - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/reserve.pass.cpp b/libcxx/test/containers/sequences/vector.bool/reserve.pass.cpp deleted file mode 100644 index be717a3be8a..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/reserve.pass.cpp +++ /dev/null @@ -1,54 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> -// vector<bool> - -// void reserve(size_type n); - -#include <vector> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - { - std::vector<bool> v; - v.reserve(10); - assert(v.capacity() >= 10); - } - { - std::vector<bool> v(100); - assert(v.capacity() >= 100); - v.reserve(50); - assert(v.size() == 100); - assert(v.capacity() >= 100); - v.reserve(150); - assert(v.size() == 100); - assert(v.capacity() >= 150); - } -#if __cplusplus >= 201103L - { - std::vector<bool, min_allocator<bool>> v; - v.reserve(10); - assert(v.capacity() >= 10); - } - { - std::vector<bool, min_allocator<bool>> v(100); - assert(v.capacity() >= 100); - v.reserve(50); - assert(v.size() == 100); - assert(v.capacity() >= 100); - v.reserve(150); - assert(v.size() == 100); - assert(v.capacity() >= 150); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/resize_size.pass.cpp b/libcxx/test/containers/sequences/vector.bool/resize_size.pass.cpp deleted file mode 100644 index f75720c94ea..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/resize_size.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> -// vector<bool> - -// void resize(size_type sz); - -#include <vector> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - { - std::vector<bool> v(100); - v.resize(50); - assert(v.size() == 50); - assert(v.capacity() >= 100); - v.resize(200); - assert(v.size() == 200); - assert(v.capacity() >= 200); - v.reserve(400); - v.resize(300); // check the case when resizing and we already have room - assert(v.size() == 300); - assert(v.capacity() >= 400); - } -#if __cplusplus >= 201103L - { - std::vector<bool, min_allocator<bool>> v(100); - v.resize(50); - assert(v.size() == 50); - assert(v.capacity() >= 100); - v.resize(200); - assert(v.size() == 200); - assert(v.capacity() >= 200); - v.reserve(400); - v.resize(300); // check the case when resizing and we already have room - assert(v.size() == 300); - assert(v.capacity() >= 400); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/resize_size_value.pass.cpp b/libcxx/test/containers/sequences/vector.bool/resize_size_value.pass.cpp deleted file mode 100644 index 8cecf44d2fb..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/resize_size_value.pass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> -// vector<bool> - -// void resize(size_type sz, const value_type& x); - -#include <vector> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - { - std::vector<bool> v(100); - v.resize(50, 1); - assert(v.size() == 50); - assert(v.capacity() >= 100); - assert(v == std::vector<bool>(50)); - v.resize(200, 1); - assert(v.size() == 200); - assert(v.capacity() >= 200); - for (unsigned i = 0; i < 50; ++i) - assert(v[i] == 0); - for (unsigned i = 50; i < 200; ++i) - assert(v[i] == 1); - } -#if __cplusplus >= 201103L - { - std::vector<bool, min_allocator<bool>> v(100); - v.resize(50, 1); - assert(v.size() == 50); - assert(v.capacity() >= 100); - assert((v == std::vector<bool, min_allocator<bool>>(50))); - v.resize(200, 1); - assert(v.size() == 200); - assert(v.capacity() >= 200); - for (unsigned i = 0; i < 50; ++i) - assert(v[i] == 0); - for (unsigned i = 50; i < 200; ++i) - assert(v[i] == 1); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/shrink_to_fit.pass.cpp b/libcxx/test/containers/sequences/vector.bool/shrink_to_fit.pass.cpp deleted file mode 100644 index 1f9fcac3d9b..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/shrink_to_fit.pass.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> -// vector<bool> - -// void shrink_to_fit(); - -#include <vector> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - { - std::vector<bool> v(100); - v.push_back(1); - v.shrink_to_fit(); - assert(v.capacity() >= 101); - assert(v.size() >= 101); - } -#if __cplusplus >= 201103L - { - std::vector<bool, min_allocator<bool>> v(100); - v.push_back(1); - v.shrink_to_fit(); - assert(v.capacity() >= 101); - assert(v.size() >= 101); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/swap.pass.cpp b/libcxx/test/containers/sequences/vector.bool/swap.pass.cpp deleted file mode 100644 index a92c6a6c165..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/swap.pass.cpp +++ /dev/null @@ -1,98 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> -// vector<bool> - -// void swap(vector& x); - -#include <vector> -#include <cassert> -#include "test_allocator.h" -#include "min_allocator.h" - -int main() -{ - { - std::vector<bool> v1(100); - std::vector<bool> v2(200); - v1.swap(v2); - assert(v1.size() == 200); - assert(v1.capacity() >= 200); - assert(v2.size() == 100); - assert(v2.capacity() >= 100); - } - { - typedef test_allocator<bool> A; - std::vector<bool, A> v1(100, true, A(1)); - std::vector<bool, A> v2(200, false, A(2)); - swap(v1, v2); - assert(v1.size() == 200); - assert(v1.capacity() >= 200); - assert(v2.size() == 100); - assert(v2.capacity() >= 100); - assert(v1.get_allocator() == A(1)); - assert(v2.get_allocator() == A(2)); - } - { - typedef other_allocator<bool> A; - std::vector<bool, A> v1(100, true, A(1)); - std::vector<bool, A> v2(200, false, A(2)); - swap(v1, v2); - assert(v1.size() == 200); - assert(v1.capacity() >= 200); - assert(v2.size() == 100); - assert(v2.capacity() >= 100); - assert(v1.get_allocator() == A(2)); - assert(v2.get_allocator() == A(1)); - } - { - std::vector<bool> v(2); - std::vector<bool>::reference r1 = v[0]; - std::vector<bool>::reference r2 = v[1]; - r1 = true; - using std::swap; - swap(r1, r2); - assert(v[0] == false); - assert(v[1] == true); - } -#if __cplusplus >= 201103L - { - std::vector<bool, min_allocator<bool>> v1(100); - std::vector<bool, min_allocator<bool>> v2(200); - v1.swap(v2); - assert(v1.size() == 200); - assert(v1.capacity() >= 200); - assert(v2.size() == 100); - assert(v2.capacity() >= 100); - } - { - typedef min_allocator<bool> A; - std::vector<bool, A> v1(100, true, A()); - std::vector<bool, A> v2(200, false, A()); - swap(v1, v2); - assert(v1.size() == 200); - assert(v1.capacity() >= 200); - assert(v2.size() == 100); - assert(v2.capacity() >= 100); - assert(v1.get_allocator() == A()); - assert(v2.get_allocator() == A()); - } - { - std::vector<bool, min_allocator<bool>> v(2); - std::vector<bool, min_allocator<bool>>::reference r1 = v[0]; - std::vector<bool, min_allocator<bool>>::reference r2 = v[1]; - r1 = true; - using std::swap; - swap(r1, r2); - assert(v[0] == false); - assert(v[1] == true); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/swap_noexcept.pass.cpp b/libcxx/test/containers/sequences/vector.bool/swap_noexcept.pass.cpp deleted file mode 100644 index bcaf161119f..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/swap_noexcept.pass.cpp +++ /dev/null @@ -1,59 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// void swap(vector& c) -// noexcept(!allocator_type::propagate_on_container_swap::value || -// __is_nothrow_swappable<allocator_type>::value); - -// This tests a conforming extension - -#include <vector> -#include <cassert> - -#include "test_allocator.h" - -template <class T> -struct some_alloc -{ - typedef T value_type; - - some_alloc() {} - some_alloc(const some_alloc&); - void deallocate(void*, unsigned) {} - - typedef std::true_type propagate_on_container_swap; -}; - -int main() -{ -#if __has_feature(cxx_noexcept) - { - typedef std::vector<bool> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); - } - { - typedef std::vector<bool, test_allocator<bool>> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); - } - { - typedef std::vector<bool, other_allocator<bool>> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); - } - { - typedef std::vector<bool, some_alloc<bool>> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); - } -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/types.pass.cpp b/libcxx/test/containers/sequences/vector.bool/types.pass.cpp deleted file mode 100644 index b266b3bbb92..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/types.pass.cpp +++ /dev/null @@ -1,72 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Test nested types and default template args: - -// template <class Allocator> -// class vector<bool, Allocator -// { -// public: -// typedef T value_type; -// typedef Allocator allocator_type; -// typedef implementation-defined iterator; -// typedef implementation-defined const_iterator; -// typedef typename allocator_type::size_type size_type; -// typedef typename allocator_type::difference_type difference_type; -// typedef typename allocator_type::pointer pointer; -// typedef typename allocator_type::const_pointer const_pointer; -// typedef std::reverse_iterator<iterator> reverse_iterator; -// typedef std::reverse_iterator<const_iterator> const_reverse_iterator; -// }; - -#include <vector> -#include <iterator> -#include <type_traits> - -#include "test_allocator.h" -#include "../../Copyable.h" -#include "min_allocator.h" - -template <class Allocator> -void -test() -{ - typedef std::vector<bool, Allocator> C; - - static_assert((std::is_same<typename C::value_type, bool>::value), ""); - static_assert((std::is_same<typename C::value_type, typename Allocator::value_type>::value), ""); - static_assert((std::is_same<typename C::allocator_type, Allocator>::value), ""); - static_assert((std::is_same<typename C::size_type, typename std::allocator_traits<Allocator>::size_type>::value), ""); - static_assert((std::is_same<typename C::difference_type, typename std::allocator_traits<Allocator>::difference_type>::value), ""); - static_assert((std::is_same< - typename std::iterator_traits<typename C::iterator>::iterator_category, - std::random_access_iterator_tag>::value), ""); - static_assert((std::is_same< - typename std::iterator_traits<typename C::const_iterator>::iterator_category, - std::random_access_iterator_tag>::value), ""); - static_assert((std::is_same< - typename C::reverse_iterator, - std::reverse_iterator<typename C::iterator> >::value), ""); - static_assert((std::is_same< - typename C::const_reverse_iterator, - std::reverse_iterator<typename C::const_iterator> >::value), ""); -} - -int main() -{ - test<test_allocator<bool> >(); - test<std::allocator<bool> >(); - static_assert((std::is_same<std::vector<bool>::allocator_type, - std::allocator<bool> >::value), ""); -#if __cplusplus >= 201103L - test<min_allocator<bool> >(); -#endif -} diff --git a/libcxx/test/containers/sequences/vector.bool/vector_bool.pass.cpp b/libcxx/test/containers/sequences/vector.bool/vector_bool.pass.cpp deleted file mode 100644 index ea2262cd9c1..00000000000 --- a/libcxx/test/containers/sequences/vector.bool/vector_bool.pass.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <functional> - -// template <class T> -// struct hash -// : public unary_function<T, size_t> -// { -// size_t operator()(T val) const; -// }; - -// Not very portable - -#include <vector> -#include <cassert> -#include <type_traits> - -#include "min_allocator.h" - -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), ""); - bool ba[] = {true, false, true, true, false}; - T vb(std::begin(ba), std::end(ba)); - H h; - assert(h(vb) != 0); - } -#if __cplusplus >= 201103L - { - typedef std::vector<bool, min_allocator<bool>> T; - typedef std::hash<T> H; - static_assert((std::is_base_of<std::unary_function<T, std::size_t>, - H>::value), ""); - bool ba[] = {true, false, true, true, false}; - T vb(std::begin(ba), std::end(ba)); - H h; - assert(h(vb) != 0); - } -#endif -} |