diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 18:01:01 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 18:01:01 +0000 |
| commit | b7332b04df5d50c92640c74cfeb138ecb7e3f7ae (patch) | |
| tree | b1b49faa0cab1482905e0cda6f0ee5d97e3fe08f /test/libcxx/strings/basic.string/string.modifiers | |
| parent | 6012fe9abb1f01b1b5b4ca908464804c21ff8602 (diff) | |
Notes
Diffstat (limited to 'test/libcxx/strings/basic.string/string.modifiers')
11 files changed, 0 insertions, 514 deletions
diff --git a/test/libcxx/strings/basic.string/string.modifiers/clear_and_shrink_db1.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/clear_and_shrink_db1.pass.cpp deleted file mode 100644 index 920c0d185261..000000000000 --- a/test/libcxx/strings/basic.string/string.modifiers/clear_and_shrink_db1.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> - -// Call __clear_and_shrink() and ensure string invariants hold - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <string> -#include <cassert> - -int main() -{ - std::string l = "Long string so that allocation definitely, for sure, absolutely happens. Probably."; - std::string s = "short"; - - assert(l.__invariants()); - assert(s.__invariants()); - - s.__clear_and_shrink(); - assert(s.__invariants()); - assert(s.size() == 0); - - { - std::string::size_type cap = l.capacity(); - l.__clear_and_shrink(); - assert(l.__invariants()); - assert(l.size() == 0); - assert(l.capacity() < cap); - } -} - -#else - -int main() -{ -} - -#endif diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp deleted file mode 100644 index 09a6aa8a6343..000000000000 --- a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.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. -// -//===----------------------------------------------------------------------===// - -// <string> - -// Call erase(const_iterator position) with end() - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <string> -#include <cassert> -#include <cstdlib> -#include <exception> - -#include "test_macros.h" -#include "min_allocator.h" - -int main() -{ - { - std::string l1("123"); - std::string::const_iterator i = l1.end(); - l1.erase(i); - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; - S l1("123"); - S::const_iterator i = l1.end(); - l1.erase(i); - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp deleted file mode 100644 index 1ff02932bd98..000000000000 --- a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp +++ /dev/null @@ -1,53 +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> - -// Call erase(const_iterator position) with iterator from another container - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <string> -#include <cassert> -#include <cstdlib> -#include <exception> - -#include "test_macros.h" -#include "min_allocator.h" - -int main() -{ - { - std::string l1("123"); - std::string l2("123"); - std::string::const_iterator i = l2.begin(); - l1.erase(i); - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; - S l1("123"); - S l2("123"); - S::const_iterator i = l2.begin(); - l1.erase(i); - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp deleted file mode 100644 index 46fa5bf434dd..000000000000 --- a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.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. -// -//===----------------------------------------------------------------------===// - -// <string> - -// Call erase(const_iterator first, const_iterator last); with first iterator from another container - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <string> -#include <cassert> -#include <exception> -#include <cstdlib> - -#include "test_macros.h" -#include "min_allocator.h" - -int main() -{ - { - std::string l1("123"); - std::string l2("123"); - std::string::iterator i = l1.erase(l2.cbegin(), l1.cbegin()+1); - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; - S l1("123"); - S l2("123"); - S::iterator i = l1.erase(l2.cbegin(), l1.cbegin()+1); - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp deleted file mode 100644 index 3ccbfad70a6b..000000000000 --- a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.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. -// -//===----------------------------------------------------------------------===// - -// <string> - -// Call erase(const_iterator first, const_iterator last); with second iterator from another container - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <string> -#include <cassert> -#include <exception> -#include <cstdlib> - -#include "test_macros.h" -#include "min_allocator.h" - -int main() -{ - { - std::string l1("123"); - std::string l2("123"); - std::string::iterator i = l1.erase(l1.cbegin(), l2.cbegin()+1); - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; - S l1("123"); - S l2("123"); - S::iterator i = l1.erase(l1.cbegin(), l2.cbegin()+1); - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp deleted file mode 100644 index e493dfea9e05..000000000000 --- a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.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. -// -//===----------------------------------------------------------------------===// - -// <string> - -// Call erase(const_iterator first, const_iterator last); with both iterators from another container - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <string> -#include <cassert> -#include <exception> -#include <cstdlib> - -#include "test_macros.h" -#include "min_allocator.h" - -int main() -{ - { - std::string l1("123"); - std::string l2("123"); - std::string::iterator i = l1.erase(l2.cbegin(), l2.cbegin()+1); - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; - S l1("123"); - S l2("123"); - S::iterator i = l1.erase(l2.cbegin(), l2.cbegin()+1); - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp deleted file mode 100644 index 918cffe733fd..000000000000 --- a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.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. -// -//===----------------------------------------------------------------------===// - -// <string> - -// Call erase(const_iterator first, const_iterator last); with a bad range - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <string> -#include <cassert> -#include <exception> -#include <cstdlib> - -#include "test_macros.h" -#include "min_allocator.h" - -int main() -{ - { - std::string l1("123"); - std::string::iterator i = l1.erase(l1.cbegin()+1, l1.cbegin()); - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; - S l1("123"); - S::iterator i = l1.erase(l1.cbegin()+1, l1.cbegin()); - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_pop_back_db1.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_pop_back_db1.pass.cpp deleted file mode 100644 index 8a6c3f0cf38f..000000000000 --- a/test/libcxx/strings/basic.string/string.modifiers/erase_pop_back_db1.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> - -// void pop_back(); - -#if _LIBCPP_DEBUG >= 1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif - -#include <string> -#include <cassert> - -#include "test_macros.h" - -int main() -{ -#if _LIBCPP_DEBUG >= 1 - { - std::string s; - s.pop_back(); - assert(false); - } -#endif -} diff --git a/test/libcxx/strings/basic.string/string.modifiers/insert_iter_char_db1.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/insert_iter_char_db1.pass.cpp deleted file mode 100644 index fbb26d178997..000000000000 --- a/test/libcxx/strings/basic.string/string.modifiers/insert_iter_char_db1.pass.cpp +++ /dev/null @@ -1,34 +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> - -// iterator insert(const_iterator p, charT c); - -#if _LIBCPP_DEBUG >= 1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif - -#include <string> -#include <stdexcept> -#include <cassert> - - -int main() -{ -#if _LIBCPP_DEBUG >= 1 - { - typedef std::string S; - S s; - S s2; - s.insert(s2.begin(), '1'); - assert(false); - } -#endif -} diff --git a/test/libcxx/strings/basic.string/string.modifiers/insert_iter_size_char_db1.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/insert_iter_size_char_db1.pass.cpp deleted file mode 100644 index 7ddd2b00d402..000000000000 --- a/test/libcxx/strings/basic.string/string.modifiers/insert_iter_size_char_db1.pass.cpp +++ /dev/null @@ -1,31 +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> - -// iterator insert(const_iterator p, size_type n, charT c); - -#if _LIBCPP_DEBUG >= 1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif - -#include <string> -#include <cassert> - -int main() -{ -#if _LIBCPP_DEBUG >= 1 - { - std::string s; - std::string s2; - s.insert(s2.begin(), 1, 'a'); - assert(false); - } -#endif -} diff --git a/test/libcxx/strings/basic.string/string.modifiers/resize_default_initialized.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/resize_default_initialized.pass.cpp deleted file mode 100644 index a3fa585e44ff..000000000000 --- a/test/libcxx/strings/basic.string/string.modifiers/resize_default_initialized.pass.cpp +++ /dev/null @@ -1,63 +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> - -// __resize_default_init(size_type) - -#include <string> -#include <cassert> - -#include "test_macros.h" - -void write_c_str(char *buf, int size) { - for (int i=0; i < size; ++i) { - buf[i] = 'a'; - } - buf[size] = '\0'; -} - -void test_buffer_usage() -{ - { - unsigned buff_size = 125; - unsigned used_size = buff_size - 16; - std::string s; - s.__resize_default_init(buff_size); - write_c_str(&s[0], used_size); - assert(s.size() == buff_size); - assert(strlen(s.data()) == used_size); - s.__resize_default_init(used_size); - assert(s.size() == used_size); - assert(s.data()[used_size] == '\0'); - for (unsigned i=0; i < used_size; ++i) { - assert(s[i] == 'a'); - } - } -} - -void test_basic() { - { - std::string s; - s.__resize_default_init(3); - assert(s.size() == 3); - assert(s.data()[3] == '\0'); - for (int i=0; i < 3; ++i) - s[i] = 'a' + i; - s.__resize_default_init(1); - assert(s[0] == 'a'); - assert(s.data()[1] == '\0'); - assert(s.size() == 1); - } -} - -int main() { - test_basic(); - test_buffer_usage(); -} |
