diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:47:26 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:47:26 +0000 |
| commit | 51072bd6bf79ef2bc6a922079bff57c31c1effbc (patch) | |
| tree | 91a2effbc9e6f80bdbbf9eb70e06c51ad0867ea0 /test/std/strings/basic.string/string.modifiers/string_erase | |
| parent | bb5e33f003797b67974a8893f7f2930fc51b8210 (diff) | |
Notes
Diffstat (limited to 'test/std/strings/basic.string/string.modifiers/string_erase')
10 files changed, 14 insertions, 321 deletions
diff --git a/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_db1.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_db1.pass.cpp deleted file mode 100644 index 6c2929d7f1d3..000000000000 --- a/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_db1.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. -// -//===----------------------------------------------------------------------===// - -// <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 "min_allocator.h" - -int main() -{ - { - std::string l1("123"); - std::string::const_iterator i = l1.end(); - l1.erase(i); - assert(false); - } -#if __cplusplus >= 201103L - { - 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/std/strings/basic.string/string.modifiers/string_erase/erase_iter_db2.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_db2.pass.cpp deleted file mode 100644 index d20fcd4623b7..000000000000 --- a/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_db2.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. -// -//===----------------------------------------------------------------------===// - -// <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 "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 __cplusplus >= 201103L - { - 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/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db1.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db1.pass.cpp deleted file mode 100644 index 5015241ad63e..000000000000 --- a/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db1.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. -// -//===----------------------------------------------------------------------===// - -// <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 "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 __cplusplus >= 201103L - { - 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/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db2.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db2.pass.cpp deleted file mode 100644 index 6a23bf88ca5c..000000000000 --- a/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db2.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. -// -//===----------------------------------------------------------------------===// - -// <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 "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 __cplusplus >= 201103L - { - 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/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db3.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db3.pass.cpp deleted file mode 100644 index a8443818aea5..000000000000 --- a/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db3.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. -// -//===----------------------------------------------------------------------===// - -// <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 "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 __cplusplus >= 201103L - { - 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/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db4.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db4.pass.cpp deleted file mode 100644 index 0549e816b44c..000000000000 --- a/test/std/strings/basic.string/string.modifiers/string_erase/erase_iter_iter_db4.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 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 "min_allocator.h" - -int main() -{ - { - std::string l1("123"); - std::string::iterator i = l1.erase(l1.cbegin()+1, l1.cbegin()); - assert(false); - } -#if __cplusplus >= 201103L - { - 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/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp index c44db71ae3b0..8de5fc7bab85 100644 --- a/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp @@ -14,6 +14,7 @@ #include <string> #include <cassert> +#include "test_macros.h" #include "min_allocator.h" template <class S> @@ -22,7 +23,7 @@ test(S s, typename S::difference_type pos, S expected) { typename S::const_iterator p = s.begin() + pos; typename S::iterator i = s.erase(p); - assert(s.__invariants()); + LIBCPP_ASSERT(s.__invariants()); assert(s == expected); assert(i - s.begin() == pos); } @@ -44,7 +45,7 @@ int main() test(S("abcdefghijklmnopqrst"), 10, S("abcdefghijlmnopqrst")); test(S("abcdefghijklmnopqrst"), 19, S("abcdefghijklmnopqrs")); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S("abcde"), 0, S("bcde")); diff --git a/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp index dbe6d7ba0e73..e4fe2cdfd022 100644 --- a/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp @@ -14,6 +14,7 @@ #include <string> #include <cassert> +#include "test_macros.h" #include "min_allocator.h" template <class S> @@ -23,7 +24,7 @@ test(S s, typename S::difference_type pos, typename S::difference_type n, S expe typename S::const_iterator first = s.cbegin() + pos; typename S::const_iterator last = s.cbegin() + pos + n; typename S::iterator i = s.erase(first, last); - assert(s.__invariants()); + LIBCPP_ASSERT(s.__invariants()); assert(s == expected); assert(i - s.begin() == pos); } @@ -87,7 +88,7 @@ int main() test(S("abcdefghijklmnopqrst"), 19, 1, S("abcdefghijklmnopqrs")); test(S("abcdefghijklmnopqrst"), 20, 0, S("abcdefghijklmnopqrst")); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), 0, 0, S("")); diff --git a/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp index 790ce40b0a00..64f8e506b13e 100644 --- a/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp @@ -11,13 +11,10 @@ // 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" #include "min_allocator.h" template <class S> @@ -25,7 +22,7 @@ void test(S s, S expected) { s.pop_back(); - assert(s.__invariants()); + LIBCPP_ASSERT(s.__invariants()); assert(s == expected); } @@ -37,7 +34,7 @@ int main() test(S("abcdefghij"), S("abcdefghi")); test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrs")); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S("abcde"), S("abcd")); @@ -45,11 +42,4 @@ int main() test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrs")); } #endif -#if _LIBCPP_DEBUG >= 1 - { - std::string s; - s.pop_back(); - assert(false); - } -#endif } diff --git a/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp index 11015cb973ed..5db97ec2cf5f 100644 --- a/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp @@ -17,6 +17,7 @@ #include <stdexcept> #include <cassert> +#include "test_macros.h" #include "min_allocator.h" template <class S> @@ -28,7 +29,7 @@ test(S s, typename S::size_type pos, typename S::size_type n, S expected) try { s.erase(pos, n); - assert(s.__invariants()); + LIBCPP_ASSERT(s.__invariants()); assert(pos <= old_size); assert(s == expected); } @@ -48,7 +49,7 @@ test(S s, typename S::size_type pos, S expected) try { s.erase(pos); - assert(s.__invariants()); + LIBCPP_ASSERT(s.__invariants()); assert(pos <= old_size); assert(s == expected); } @@ -64,7 +65,7 @@ void test(S s, S expected) { s.erase(); - assert(s.__invariants()); + LIBCPP_ASSERT(s.__invariants()); assert(s == expected); } @@ -173,7 +174,7 @@ int main() test(S("abcdefghij"), S("")); test(S("abcdefghijklmnopqrst"), S("")); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), 0, 0, S("")); |
