summaryrefslogtreecommitdiff
path: root/libcxx/test/strings/basic.string/string.cons
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/strings/basic.string/string.cons')
-rw-r--r--libcxx/test/strings/basic.string/string.cons/alloc.pass.cpp44
-rw-r--r--libcxx/test/strings/basic.string/string.cons/char_assignment.pass.cpp36
-rw-r--r--libcxx/test/strings/basic.string/string.cons/copy.pass.cpp37
-rw-r--r--libcxx/test/strings/basic.string/string.cons/copy_alloc.pass.cpp37
-rw-r--r--libcxx/test/strings/basic.string/string.cons/copy_assignment.pass.cpp46
-rw-r--r--libcxx/test/strings/basic.string/string.cons/default_noexcept.pass.cpp45
-rw-r--r--libcxx/test/strings/basic.string/string.cons/dtor_noexcept.pass.cpp47
-rw-r--r--libcxx/test/strings/basic.string/string.cons/initializer_list.pass.cpp32
-rw-r--r--libcxx/test/strings/basic.string/string.cons/initializer_list_assignment.pass.cpp26
-rw-r--r--libcxx/test/strings/basic.string/string.cons/iter_alloc.pass.cpp87
-rw-r--r--libcxx/test/strings/basic.string/string.cons/move.pass.cpp45
-rw-r--r--libcxx/test/strings/basic.string/string.cons/move_alloc.pass.cpp45
-rw-r--r--libcxx/test/strings/basic.string/string.cons/move_assign_noexcept.pass.cpp47
-rw-r--r--libcxx/test/strings/basic.string/string.cons/move_assignment.pass.cpp56
-rw-r--r--libcxx/test/strings/basic.string/string.cons/move_noexcept.pass.cpp45
-rw-r--r--libcxx/test/strings/basic.string/string.cons/pointer_alloc.pass.cpp69
-rw-r--r--libcxx/test/strings/basic.string/string.cons/pointer_assignment.pass.cpp48
-rw-r--r--libcxx/test/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp67
-rw-r--r--libcxx/test/strings/basic.string/string.cons/size_char_alloc.pass.cpp106
-rw-r--r--libcxx/test/strings/basic.string/string.cons/substr.pass.cpp130
20 files changed, 0 insertions, 1095 deletions
diff --git a/libcxx/test/strings/basic.string/string.cons/alloc.pass.cpp b/libcxx/test/strings/basic.string/string.cons/alloc.pass.cpp
deleted file mode 100644
index 8eb9c844d20b..000000000000
--- a/libcxx/test/strings/basic.string/string.cons/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.
-//
-//===----------------------------------------------------------------------===//
-
-// <string>
-
-// explicit basic_string(const Allocator& a = Allocator());
-
-#include <string>
-#include <cassert>
-
-#include "../test_allocator.h"
-
-template <class S>
-void
-test()
-{
- {
- S s;
- assert(s.__invariants());
- assert(s.data());
- assert(s.size() == 0);
- assert(s.capacity() >= s.size());
- assert(s.get_allocator() == typename S::allocator_type());
- }
- {
- S s(typename S::allocator_type(5));
- assert(s.__invariants());
- assert(s.data());
- assert(s.size() == 0);
- assert(s.capacity() >= s.size());
- assert(s.get_allocator() == typename S::allocator_type(5));
- }
-}
-
-int main()
-{
- test<std::basic_string<char, std::char_traits<char>, test_allocator<char> > >();
-}
diff --git a/libcxx/test/strings/basic.string/string.cons/char_assignment.pass.cpp b/libcxx/test/strings/basic.string/string.cons/char_assignment.pass.cpp
deleted file mode 100644
index 2a5afa2a0663..000000000000
--- a/libcxx/test/strings/basic.string/string.cons/char_assignment.pass.cpp
+++ /dev/null
@@ -1,36 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <string>
-
-// basic_string<charT,traits,Allocator>& operator=(charT c);
-
-#include <string>
-#include <cassert>
-
-template <class S>
-void
-test(S s1, typename S::value_type s2)
-{
- typedef typename S::traits_type T;
- s1 = s2;
- assert(s1.__invariants());
- assert(s1.size() == 1);
- assert(T::eq(s1[0], s2));
- assert(s1.capacity() >= s1.size());
-}
-
-int main()
-{
- typedef std::string S;
- test(S(), 'a');
- test(S("1"), 'a');
- test(S("123456789"), 'a');
- test(S("1234567890123456789012345678901234567890123456789012345678901234567890"), 'a');
-}
diff --git a/libcxx/test/strings/basic.string/string.cons/copy.pass.cpp b/libcxx/test/strings/basic.string/string.cons/copy.pass.cpp
deleted file mode 100644
index c34658f45683..000000000000
--- a/libcxx/test/strings/basic.string/string.cons/copy.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.
-//
-//===----------------------------------------------------------------------===//
-
-// <string>
-
-// basic_string(const basic_string<charT,traits,Allocator>& str);
-
-#include <string>
-#include <cassert>
-
-#include "../test_allocator.h"
-
-template <class S>
-void
-test(S s1)
-{
- S s2 = s1;
- assert(s2.__invariants());
- assert(s2 == s1);
- assert(s2.capacity() >= s2.size());
- assert(s2.get_allocator() == s1.get_allocator());
-}
-
-int main()
-{
- typedef test_allocator<char> A;
- typedef std::basic_string<char, std::char_traits<char>, A> S;
- test(S(A(3)));
- test(S("1", A(5)));
- test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)));
-}
diff --git a/libcxx/test/strings/basic.string/string.cons/copy_alloc.pass.cpp b/libcxx/test/strings/basic.string/string.cons/copy_alloc.pass.cpp
deleted file mode 100644
index 951330c596fd..000000000000
--- a/libcxx/test/strings/basic.string/string.cons/copy_alloc.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.
-//
-//===----------------------------------------------------------------------===//
-
-// <string>
-
-// basic_string(const basic_string& str, const Allocator& alloc);
-
-#include <string>
-#include <cassert>
-
-#include "../test_allocator.h"
-
-template <class S>
-void
-test(S s1, const typename S::allocator_type& a)
-{
- S s2(s1, a);
- assert(s2.__invariants());
- assert(s2 == s1);
- assert(s2.capacity() >= s2.size());
- assert(s2.get_allocator() == a);
-}
-
-int main()
-{
- typedef test_allocator<char> A;
- typedef std::basic_string<char, std::char_traits<char>, A> S;
- test(S(), A(3));
- test(S("1"), A(5));
- test(S("1234567890123456789012345678901234567890123456789012345678901234567890"), A(7));
-}
diff --git a/libcxx/test/strings/basic.string/string.cons/copy_assignment.pass.cpp b/libcxx/test/strings/basic.string/string.cons/copy_assignment.pass.cpp
deleted file mode 100644
index f15f2796d0b2..000000000000
--- a/libcxx/test/strings/basic.string/string.cons/copy_assignment.pass.cpp
+++ /dev/null
@@ -1,46 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <string>
-
-// basic_string<charT,traits,Allocator>&
-// operator=(const basic_string<charT,traits,Allocator>& str);
-
-#include <string>
-#include <cassert>
-
-template <class S>
-void
-test(S s1, const S& s2)
-{
- s1 = s2;
- assert(s1.__invariants());
- assert(s1 == s2);
- assert(s1.capacity() >= s1.size());
-}
-
-int main()
-{
- typedef std::string S;
- test(S(), S());
- test(S("1"), S());
- test(S(), S("1"));
- test(S("1"), S("2"));
- test(S("1"), S("2"));
-
- test(S(),
- S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
- test(S("123456789"),
- S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
- test(S("1234567890123456789012345678901234567890123456789012345678901234567890"),
- S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
- test(S("1234567890123456789012345678901234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890123456789012345678901234567890"),
- S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
-}
diff --git a/libcxx/test/strings/basic.string/string.cons/default_noexcept.pass.cpp b/libcxx/test/strings/basic.string/string.cons/default_noexcept.pass.cpp
deleted file mode 100644
index ed68c93c7f3a..000000000000
--- a/libcxx/test/strings/basic.string/string.cons/default_noexcept.pass.cpp
+++ /dev/null
@@ -1,45 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <string>
-
-// basic_string()
-// noexcept(is_nothrow_default_constructible<allocator_type>::value);
-
-// This tests a conforming extension
-
-#include <string>
-#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::string C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::basic_string<char, std::char_traits<char>, test_allocator<char>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::basic_string<char, std::char_traits<char>, some_alloc<char>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
-#endif
-}
diff --git a/libcxx/test/strings/basic.string/string.cons/dtor_noexcept.pass.cpp b/libcxx/test/strings/basic.string/string.cons/dtor_noexcept.pass.cpp
deleted file mode 100644
index c4550833fb22..000000000000
--- a/libcxx/test/strings/basic.string/string.cons/dtor_noexcept.pass.cpp
+++ /dev/null
@@ -1,47 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <string>
-
-// ~basic_string() // implied noexcept;
-
-#include <string>
-#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::string C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::basic_string<char, std::char_traits<char>, test_allocator<char>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::basic_string<char, std::char_traits<char>, some_alloc<char>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
- }
-#endif
-}
diff --git a/libcxx/test/strings/basic.string/string.cons/initializer_list.pass.cpp b/libcxx/test/strings/basic.string/string.cons/initializer_list.pass.cpp
deleted file mode 100644
index 430c2acf62e5..000000000000
--- a/libcxx/test/strings/basic.string/string.cons/initializer_list.pass.cpp
+++ /dev/null
@@ -1,32 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <string>
-
-// basic_string(initializer_list<charT> il, const Allocator& a = Allocator());
-
-#include <string>
-#include <cassert>
-
-#include "../test_allocator.h"
-
-int main()
-{
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
- {
- std::string s = {'a', 'b', 'c'};
- assert(s == "abc");
- }
- {
- std::wstring s;
- s = {L'a', L'b', L'c'};
- assert(s == L"abc");
- }
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-}
diff --git a/libcxx/test/strings/basic.string/string.cons/initializer_list_assignment.pass.cpp b/libcxx/test/strings/basic.string/string.cons/initializer_list_assignment.pass.cpp
deleted file mode 100644
index f7ac16f1fb65..000000000000
--- a/libcxx/test/strings/basic.string/string.cons/initializer_list_assignment.pass.cpp
+++ /dev/null
@@ -1,26 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <string>
-
-// basic_string& operator=(initializer_list<charT> il);
-
-#include <string>
-#include <cassert>
-
-int main()
-{
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
- {
- std::string s;
- s = {'a', 'b', 'c'};
- assert(s == "abc");
- }
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-}
diff --git a/libcxx/test/strings/basic.string/string.cons/iter_alloc.pass.cpp b/libcxx/test/strings/basic.string/string.cons/iter_alloc.pass.cpp
deleted file mode 100644
index c902531aca45..000000000000
--- a/libcxx/test/strings/basic.string/string.cons/iter_alloc.pass.cpp
+++ /dev/null
@@ -1,87 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <string>
-
-// template<class InputIterator>
-// basic_string(InputIterator begin, InputIterator end,
-// const Allocator& a = Allocator());
-
-#include <string>
-#include <iterator>
-#include <cassert>
-
-#include "../test_allocator.h"
-#include "../input_iterator.h"
-
-template <class It>
-void
-test(It first, It last)
-{
- typedef typename std::iterator_traits<It>::value_type charT;
- typedef std::basic_string<charT, std::char_traits<charT>, test_allocator<charT> > S;
- typedef typename S::traits_type T;
- typedef typename S::allocator_type A;
- S s2(first, last);
- assert(s2.__invariants());
- assert(s2.size() == std::distance(first, last));
- unsigned i = 0;
- for (It it = first; it != last; ++it, ++i)
- assert(s2[i] == *it);
- assert(s2.get_allocator() == A());
- assert(s2.capacity() >= s2.size());
-}
-
-template <class It>
-void
-test(It first, It last, const test_allocator<typename std::iterator_traits<It>::value_type>& a)
-{
- typedef typename std::iterator_traits<It>::value_type charT;
- typedef std::basic_string<charT, std::char_traits<charT>, test_allocator<charT> > S;
- typedef typename S::traits_type T;
- typedef typename S::allocator_type A;
- S s2(first, last, a);
- assert(s2.__invariants());
- assert(s2.size() == std::distance(first, last));
- unsigned i = 0;
- for (It it = first; it != last; ++it, ++i)
- assert(s2[i] == *it);
- assert(s2.get_allocator() == a);
- assert(s2.capacity() >= s2.size());
-}
-
-int main()
-{
- typedef test_allocator<char> A;
- const char* s = "12345678901234567890123456789012345678901234567890";
-
- test(s, s);
- test(s, s, A(2));
-
- test(s, s+1);
- test(s, s+1, A(2));
-
- test(s, s+10);
- test(s, s+10, A(2));
-
- test(s, s+50);
- test(s, s+50, A(2));
-
- test(input_iterator<const char*>(s), input_iterator<const char*>(s));
- test(input_iterator<const char*>(s), input_iterator<const char*>(s), A(2));
-
- test(input_iterator<const char*>(s), input_iterator<const char*>(s+1));
- test(input_iterator<const char*>(s), input_iterator<const char*>(s+1), A(2));
-
- test(input_iterator<const char*>(s), input_iterator<const char*>(s+10));
- test(input_iterator<const char*>(s), input_iterator<const char*>(s+10), A(2));
-
- test(input_iterator<const char*>(s), input_iterator<const char*>(s+50));
- test(input_iterator<const char*>(s), input_iterator<const char*>(s+50), A(2));
-}
diff --git a/libcxx/test/strings/basic.string/string.cons/move.pass.cpp b/libcxx/test/strings/basic.string/string.cons/move.pass.cpp
deleted file mode 100644
index 2d33937d4fe5..000000000000
--- a/libcxx/test/strings/basic.string/string.cons/move.pass.cpp
+++ /dev/null
@@ -1,45 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <string>
-
-// basic_string(basic_string<charT,traits,Allocator>&& str);
-
-#include <string>
-#include <cassert>
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-#include "../test_allocator.h"
-
-template <class S>
-void
-test(S s0)
-{
- S s1 = s0;
- S s2 = std::move(s0);
- assert(s2.__invariants());
- assert(s0.__invariants());
- assert(s2 == s1);
- assert(s2.capacity() >= s2.size());
- assert(s2.get_allocator() == s1.get_allocator());
-}
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-int main()
-{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- typedef test_allocator<char> A;
- typedef std::basic_string<char, std::char_traits<char>, A> S;
- test(S(A(3)));
- test(S("1", A(5)));
- test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)));
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-}
diff --git a/libcxx/test/strings/basic.string/string.cons/move_alloc.pass.cpp b/libcxx/test/strings/basic.string/string.cons/move_alloc.pass.cpp
deleted file mode 100644
index 60d132f21390..000000000000
--- a/libcxx/test/strings/basic.string/string.cons/move_alloc.pass.cpp
+++ /dev/null
@@ -1,45 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <string>
-
-// basic_string(basic_string&& str, const Allocator& alloc);
-
-#include <string>
-#include <cassert>
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-#include "../test_allocator.h"
-
-template <class S>
-void
-test(S s0, const typename S::allocator_type& a)
-{
- S s1 = s0;
- S s2(std::move(s0), a);
- assert(s2.__invariants());
- assert(s0.__invariants());
- assert(s2 == s1);
- assert(s2.capacity() >= s2.size());
- assert(s2.get_allocator() == a);
-}
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-int main()
-{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- typedef test_allocator<char> A;
- typedef std::basic_string<char, std::char_traits<char>, A> S;
- test(S(), A(3));
- test(S("1"), A(5));
- test(S("1234567890123456789012345678901234567890123456789012345678901234567890"), A(7));
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-}
diff --git a/libcxx/test/strings/basic.string/string.cons/move_assign_noexcept.pass.cpp b/libcxx/test/strings/basic.string/string.cons/move_assign_noexcept.pass.cpp
deleted file mode 100644
index fdcf4785fbc4..000000000000
--- a/libcxx/test/strings/basic.string/string.cons/move_assign_noexcept.pass.cpp
+++ /dev/null
@@ -1,47 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <string>
-
-// basic_string& operator=(basic_string&& c)
-// noexcept(
-// allocator_type::propagate_on_container_move_assignment::value &&
-// is_nothrow_move_assignable<allocator_type>::value);
-
-// This tests a conforming extension
-
-#include <string>
-#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::string C;
- static_assert(std::is_nothrow_move_assignable<C>::value, "");
- }
- {
- typedef std::basic_string<char, std::char_traits<char>, test_allocator<char>> C;
- static_assert(!std::is_nothrow_move_assignable<C>::value, "");
- }
- {
- typedef std::basic_string<char, std::char_traits<char>, some_alloc<char>> C;
- static_assert(!std::is_nothrow_move_assignable<C>::value, "");
- }
-#endif
-}
diff --git a/libcxx/test/strings/basic.string/string.cons/move_assignment.pass.cpp b/libcxx/test/strings/basic.string/string.cons/move_assignment.pass.cpp
deleted file mode 100644
index 739f09d1e0fd..000000000000
--- a/libcxx/test/strings/basic.string/string.cons/move_assignment.pass.cpp
+++ /dev/null
@@ -1,56 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <string>
-
-// basic_string<charT,traits,Allocator>&
-// operator=(basic_string<charT,traits,Allocator>&& str);
-
-#include <string>
-#include <cassert>
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-#include "../test_allocator.h"
-
-template <class S>
-void
-test(S s1, S s2)
-{
- S s0 = s2;
- s1 = std::move(s2);
- assert(s1.__invariants());
- assert(s2.__invariants());
- assert(s1 == s0);
- assert(s1.capacity() >= s1.size());
-}
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-int main()
-{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- typedef std::string S;
- test(S(), S());
- test(S("1"), S());
- test(S(), S("1"));
- test(S("1"), S("2"));
- test(S("1"), S("2"));
-
- test(S(),
- S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
- test(S("123456789"),
- S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
- test(S("1234567890123456789012345678901234567890123456789012345678901234567890"),
- S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
- test(S("1234567890123456789012345678901234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890123456789012345678901234567890"),
- S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-}
diff --git a/libcxx/test/strings/basic.string/string.cons/move_noexcept.pass.cpp b/libcxx/test/strings/basic.string/string.cons/move_noexcept.pass.cpp
deleted file mode 100644
index 42e828b88383..000000000000
--- a/libcxx/test/strings/basic.string/string.cons/move_noexcept.pass.cpp
+++ /dev/null
@@ -1,45 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <string>
-
-// basic_string(basic_string&&)
-// noexcept(is_nothrow_move_constructible<allocator_type>::value);
-
-// This tests a conforming extension
-
-#include <string>
-#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::string C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::basic_string<char, std::char_traits<char>, test_allocator<char>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::basic_string<char, std::char_traits<char>, some_alloc<char>> C;
- static_assert(!std::is_nothrow_move_constructible<C>::value, "");
- }
-#endif
-}
diff --git a/libcxx/test/strings/basic.string/string.cons/pointer_alloc.pass.cpp b/libcxx/test/strings/basic.string/string.cons/pointer_alloc.pass.cpp
deleted file mode 100644
index db2f733331ee..000000000000
--- a/libcxx/test/strings/basic.string/string.cons/pointer_alloc.pass.cpp
+++ /dev/null
@@ -1,69 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <string>
-
-// basic_string(const charT* s, const Allocator& a = Allocator());
-
-#include <string>
-#include <stdexcept>
-#include <algorithm>
-#include <cassert>
-
-#include "../test_allocator.h"
-
-template <class charT>
-void
-test(const charT* s)
-{
- typedef std::basic_string<charT, std::char_traits<charT>, test_allocator<charT> > S;
- typedef typename S::traits_type T;
- typedef typename S::allocator_type A;
- unsigned n = T::length(s);
- S s2(s);
- assert(s2.__invariants());
- assert(s2.size() == n);
- assert(T::compare(s2.data(), s, n) == 0);
- assert(s2.get_allocator() == A());
- assert(s2.capacity() >= s2.size());
-}
-
-template <class charT>
-void
-test(const charT* s, const test_allocator<charT>& a)
-{
- typedef std::basic_string<charT, std::char_traits<charT>, test_allocator<charT> > S;
- typedef typename S::traits_type T;
- typedef typename S::allocator_type A;
- unsigned n = T::length(s);
- S s2(s, a);
- assert(s2.__invariants());
- assert(s2.size() == n);
- assert(T::compare(s2.data(), s, n) == 0);
- assert(s2.get_allocator() == a);
- assert(s2.capacity() >= s2.size());
-}
-
-int main()
-{
- typedef test_allocator<char> A;
- typedef std::basic_string<char, std::char_traits<char>, A> S;
-
- test("");
- test("", A(2));
-
- test("1");
- test("1", A(2));
-
- test("1234567980");
- test("1234567980", A(2));
-
- test("123456798012345679801234567980123456798012345679801234567980");
- test("123456798012345679801234567980123456798012345679801234567980", A(2));
-}
diff --git a/libcxx/test/strings/basic.string/string.cons/pointer_assignment.pass.cpp b/libcxx/test/strings/basic.string/string.cons/pointer_assignment.pass.cpp
deleted file mode 100644
index 660e1cf189d2..000000000000
--- a/libcxx/test/strings/basic.string/string.cons/pointer_assignment.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.
-//
-//===----------------------------------------------------------------------===//
-
-// <string>
-
-// basic_string<charT,traits,Allocator>&
-// operator=(const charT* s);
-
-#include <string>
-#include <cassert>
-
-template <class S>
-void
-test(S s1, const typename S::value_type* s2)
-{
- typedef typename S::traits_type T;
- s1 = s2;
- assert(s1.__invariants());
- assert(s1.size() == T::length(s2));
- assert(T::compare(s1.data(), s2, s1.size()) == 0);
- assert(s1.capacity() >= s1.size());
-}
-
-int main()
-{
- typedef std::string S;
- test(S(), "");
- test(S("1"), "");
- test(S(), "1");
- test(S("1"), "2");
- test(S("1"), "2");
-
- test(S(),
- "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
- test(S("123456789"),
- "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
- test(S("1234567890123456789012345678901234567890123456789012345678901234567890"),
- "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
- test(S("1234567890123456789012345678901234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890123456789012345678901234567890"),
- "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
-}
diff --git a/libcxx/test/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp b/libcxx/test/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp
deleted file mode 100644
index 169e1128f166..000000000000
--- a/libcxx/test/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp
+++ /dev/null
@@ -1,67 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <string>
-
-// basic_string(const charT* s, size_type n, const Allocator& a = Allocator());
-
-#include <string>
-#include <stdexcept>
-#include <algorithm>
-#include <cassert>
-
-#include "../test_allocator.h"
-
-template <class charT>
-void
-test(const charT* s, unsigned n)
-{
- typedef std::basic_string<charT, std::char_traits<charT>, test_allocator<charT> > S;
- typedef typename S::traits_type T;
- typedef typename S::allocator_type A;
- S s2(s, n);
- assert(s2.__invariants());
- assert(s2.size() == n);
- assert(T::compare(s2.data(), s, n) == 0);
- assert(s2.get_allocator() == A());
- assert(s2.capacity() >= s2.size());
-}
-
-template <class charT>
-void
-test(const charT* s, unsigned n, const test_allocator<charT>& a)
-{
- typedef std::basic_string<charT, std::char_traits<charT>, test_allocator<charT> > S;
- typedef typename S::traits_type T;
- typedef typename S::allocator_type A;
- S s2(s, n, a);
- assert(s2.__invariants());
- assert(s2.size() == n);
- assert(T::compare(s2.data(), s, n) == 0);
- assert(s2.get_allocator() == a);
- assert(s2.capacity() >= s2.size());
-}
-
-int main()
-{
- typedef test_allocator<char> A;
- typedef std::basic_string<char, std::char_traits<char>, A> S;
-
- test("", 0);
- test("", 0, A(2));
-
- test("1", 1);
- test("1", 1, A(2));
-
- test("1234567980", 10);
- test("1234567980", 10, A(2));
-
- test("123456798012345679801234567980123456798012345679801234567980", 60);
- test("123456798012345679801234567980123456798012345679801234567980", 60, A(2));
-}
diff --git a/libcxx/test/strings/basic.string/string.cons/size_char_alloc.pass.cpp b/libcxx/test/strings/basic.string/string.cons/size_char_alloc.pass.cpp
deleted file mode 100644
index 6ed5f0470671..000000000000
--- a/libcxx/test/strings/basic.string/string.cons/size_char_alloc.pass.cpp
+++ /dev/null
@@ -1,106 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <string>
-
-// basic_string(size_type n, charT c, const Allocator& a = Allocator());
-
-#include <string>
-#include <stdexcept>
-#include <algorithm>
-#include <cassert>
-
-#include "../test_allocator.h"
-
-template <class charT>
-void
-test(unsigned n, charT c)
-{
- typedef std::basic_string<charT, std::char_traits<charT>, test_allocator<charT> > S;
- typedef typename S::traits_type T;
- typedef typename S::allocator_type A;
- S s2(n, c);
- assert(s2.__invariants());
- assert(s2.size() == n);
- for (unsigned i = 0; i < n; ++i)
- assert(s2[i] == c);
- assert(s2.get_allocator() == A());
- assert(s2.capacity() >= s2.size());
-}
-
-template <class charT>
-void
-test(unsigned n, charT c, const test_allocator<charT>& a)
-{
- typedef std::basic_string<charT, std::char_traits<charT>, test_allocator<charT> > S;
- typedef typename S::traits_type T;
- typedef typename S::allocator_type A;
- S s2(n, c, a);
- assert(s2.__invariants());
- assert(s2.size() == n);
- for (unsigned i = 0; i < n; ++i)
- assert(s2[i] == c);
- assert(s2.get_allocator() == a);
- assert(s2.capacity() >= s2.size());
-}
-
-template <class Tp>
-void
-test(Tp n, Tp c)
-{
- typedef char charT;
- typedef std::basic_string<charT, std::char_traits<charT>, test_allocator<charT> > S;
- typedef typename S::traits_type T;
- typedef typename S::allocator_type A;
- S s2(n, c);
- assert(s2.__invariants());
- assert(s2.size() == n);
- for (unsigned i = 0; i < n; ++i)
- assert(s2[i] == c);
- assert(s2.get_allocator() == A());
- assert(s2.capacity() >= s2.size());
-}
-
-template <class Tp>
-void
-test(Tp n, Tp c, const test_allocator<char>& a)
-{
- typedef char charT;
- typedef std::basic_string<charT, std::char_traits<charT>, test_allocator<charT> > S;
- typedef typename S::traits_type T;
- typedef typename S::allocator_type A;
- S s2(n, c, a);
- assert(s2.__invariants());
- assert(s2.size() == n);
- for (unsigned i = 0; i < n; ++i)
- assert(s2[i] == c);
- assert(s2.get_allocator() == a);
- assert(s2.capacity() >= s2.size());
-}
-
-int main()
-{
- typedef test_allocator<char> A;
- typedef std::basic_string<char, std::char_traits<char>, A> S;
-
- test(0, 'a');
- test(0, 'a', A(2));
-
- test(1, 'a');
- test(1, 'a', A(2));
-
- test(10, 'a');
- test(10, 'a', A(2));
-
- test(100, 'a');
- test(100, 'a', A(2));
-
- test(100, 65);
- test(100, 65, A(3));
-}
diff --git a/libcxx/test/strings/basic.string/string.cons/substr.pass.cpp b/libcxx/test/strings/basic.string/string.cons/substr.pass.cpp
deleted file mode 100644
index 65fbfbd1316e..000000000000
--- a/libcxx/test/strings/basic.string/string.cons/substr.pass.cpp
+++ /dev/null
@@ -1,130 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <string>
-
-// basic_string(const basic_string<charT,traits,Allocator>& str,
-// size_type pos, size_type n = npos,
-// const Allocator& a = Allocator());
-
-#include <string>
-#include <stdexcept>
-#include <algorithm>
-#include <cassert>
-
-#include "../test_allocator.h"
-
-template <class S>
-void
-test(S str, unsigned pos)
-{
- typedef typename S::traits_type T;
- typedef typename S::allocator_type A;
- try
- {
- S s2(str, pos);
- assert(s2.__invariants());
- assert(pos <= str.size());
- unsigned rlen = str.size() - pos;
- assert(s2.size() == rlen);
- assert(T::compare(s2.data(), str.data() + pos, rlen) == 0);
- assert(s2.get_allocator() == A());
- assert(s2.capacity() >= s2.size());
- }
- catch (std::out_of_range&)
- {
- assert(pos > str.size());
- }
-}
-
-template <class S>
-void
-test(S str, unsigned pos, unsigned n)
-{
- typedef typename S::traits_type T;
- typedef typename S::allocator_type A;
- try
- {
- S s2(str, pos, n);
- assert(s2.__invariants());
- assert(pos <= str.size());
- unsigned rlen = std::min(str.size() - pos, n);
- assert(s2.size() == rlen);
- assert(T::compare(s2.data(), str.data() + pos, rlen) == 0);
- assert(s2.get_allocator() == A());
- assert(s2.capacity() >= s2.size());
- }
- catch (std::out_of_range&)
- {
- assert(pos > str.size());
- }
-}
-
-template <class S>
-void
-test(S str, unsigned pos, unsigned n, const typename S::allocator_type& a)
-{
- typedef typename S::traits_type T;
- typedef typename S::allocator_type A;
- try
- {
- S s2(str, pos, n, a);
- assert(s2.__invariants());
- assert(pos <= str.size());
- unsigned rlen = std::min(str.size() - pos, n);
- assert(s2.size() == rlen);
- assert(T::compare(s2.data(), str.data() + pos, rlen) == 0);
- assert(s2.get_allocator() == a);
- assert(s2.capacity() >= s2.size());
- }
- catch (std::out_of_range&)
- {
- assert(pos > str.size());
- }
-}
-
-int main()
-{
- typedef test_allocator<char> A;
- typedef std::basic_string<char, std::char_traits<char>, A> S;
-
- test(S(A(3)), 0);
- test(S(A(3)), 1);
- test(S("1", A(5)), 0);
- test(S("1", A(5)), 1);
- test(S("1", A(5)), 2);
- test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)), 0);
- test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)), 5);
- test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)), 50);
- test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)), 500);
-
- test(S(A(3)), 0, 0);
- test(S(A(3)), 0, 1);
- test(S(A(3)), 1, 0);
- test(S(A(3)), 1, 1);
- test(S(A(3)), 1, 2);
- test(S("1", A(5)), 0, 0);
- test(S("1", A(5)), 0, 1);
- test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)), 50, 0);
- test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)), 50, 1);
- test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)), 50, 10);
- test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)), 50, 100);
-
- test(S(A(3)), 0, 0, A(4));
- test(S(A(3)), 0, 1, A(4));
- test(S(A(3)), 1, 0, A(4));
- test(S(A(3)), 1, 1, A(4));
- test(S(A(3)), 1, 2, A(4));
- test(S("1", A(5)), 0, 0, A(6));
- test(S("1", A(5)), 0, 1, A(6));
- test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)), 50, 0, A(8));
- test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)), 50, 1, A(8));
- test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)), 50, 10, A(8));
- test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)), 50, 100, A(8));
-}