diff options
Diffstat (limited to 'test/std/strings/basic.string/string.modifiers/string_replace')
10 files changed, 24 insertions, 22 deletions
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp index 057964112aa1..cc37e79c7932 100644 --- a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp @@ -29,12 +29,13 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, It f, It l, S ex typename S::const_iterator last = s.begin() + pos1 + n1; typename S::size_type xlen = last - first; s.replace(first, last, f, l); - assert(s.__invariants()); + LIBCPP_ASSERT(s.__invariants()); assert(s == expected); typename S::size_type rlen = std::distance(f, l); assert(s.size() == old_size - xlen + rlen); } +#ifndef TEST_HAS_NO_EXCEPTIONS template <class S, class It> void test_exceptions(S s, typename S::size_type pos1, typename S::size_type n1, It f, It l) @@ -47,9 +48,10 @@ test_exceptions(S s, typename S::size_type pos1, typename S::size_type n1, It f, assert(false); } catch (...) {} - assert(s.__invariants()); + LIBCPP_ASSERT(s.__invariants()); assert(s == aCopy); } +#endif const char* str = "12345678901234567890"; @@ -990,6 +992,7 @@ int main() test8<S>(); } #endif +#ifndef TEST_HAS_NO_EXCEPTIONS { // test iterator operations that throw typedef std::string S; typedef ThrowingIterator<char> TIter; @@ -1003,4 +1006,5 @@ int main() test_exceptions(S("abcdefghijklmnopqrst"), 10, 5, TIter(s, s+10, 5, TIter::TADereference), TIter()); test_exceptions(S("abcdefghijklmnopqrst"), 10, 5, TIter(s, s+10, 6, TIter::TAComparison), TIter()); } +#endif } diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp index c7551b928ec1..730fc1a501cf 100644 --- a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp @@ -29,7 +29,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, const typename S typename S::const_iterator last = s.begin() + pos1 + n1; typename S::size_type xlen = last - first; s.replace(first, last, str); - assert(s.__invariants()); + LIBCPP_ASSERT(s.__invariants()); assert(s == expected); typename S::size_type rlen = S::traits_type::length(str); assert(s.size() == old_size - xlen + rlen); diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp index 087df7824ac2..4a910e499819 100644 --- a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp @@ -12,12 +12,11 @@ // basic_string<charT,traits,Allocator>& // replace(const_iterator i1, const_iterator i2, const charT* s, size_type n); -#include <stdio.h> - #include <string> #include <algorithm> #include <cassert> +#include "test_macros.h" #include "min_allocator.h" template <class S> @@ -30,7 +29,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, const typename S typename S::const_iterator last = s.begin() + pos1 + n1; typename S::size_type xlen = last - first; s.replace(first, last, str, n2); - assert(s.__invariants()); + LIBCPP_ASSERT(s.__invariants()); assert(s == expected); typename S::size_type rlen = n2; assert(s.size() == old_size - xlen + rlen); diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp index 8be8b5298237..4dbc8ab1f22c 100644 --- a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp @@ -12,12 +12,11 @@ // basic_string<charT,traits,Allocator>& // replace(const_iterator i1, const_iterator i2, size_type n, charT c); -#include <stdio.h> - #include <string> #include <algorithm> #include <cassert> +#include "test_macros.h" #include "min_allocator.h" template <class S> @@ -30,7 +29,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, typename S::size typename S::const_iterator last = s.begin() + pos1 + n1; typename S::size_type xlen = last - first; s.replace(first, last, n2, c); - assert(s.__invariants()); + LIBCPP_ASSERT(s.__invariants()); assert(s == expected); typename S::size_type rlen = n2; assert(s.size() == old_size - xlen + rlen); diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp index b85a1063ebe1..190e10d5c830 100644 --- a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp @@ -12,12 +12,11 @@ // basic_string<charT,traits,Allocator>& // replace(const_iterator i1, const_iterator i2, const basic_string& str); -#include <stdio.h> - #include <string> #include <algorithm> #include <cassert> +#include "test_macros.h" #include "min_allocator.h" template <class S> @@ -29,7 +28,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expecte typename S::const_iterator last = s.begin() + pos1 + n1; typename S::size_type xlen = last - first; s.replace(first, last, str); - assert(s.__invariants()); + LIBCPP_ASSERT(s.__invariants()); assert(s == expected); typename S::size_type rlen = str.size(); assert(s.size() == old_size - xlen + rlen); diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp index eb0e982ef16e..3beb074c0fd3 100644 --- a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp @@ -13,13 +13,12 @@ // basic_string<charT,traits,Allocator>& // replace(size_type pos, size_type n1, const charT* s); -#include <stdio.h> - #include <string> #include <stdexcept> #include <algorithm> #include <cassert> +#include "test_macros.h" #include "min_allocator.h" template <class S> @@ -32,7 +31,7 @@ test(S s, typename S::size_type pos, typename S::size_type n1, try { s.replace(pos, n1, str); - assert(s.__invariants()); + LIBCPP_ASSERT(s.__invariants()); assert(pos <= old_size); assert(s == expected); typename S::size_type xlen = std::min(n1, old_size - pos); diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp index 898ab2a144c1..d961e9e8f76f 100644 --- a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp @@ -13,13 +13,12 @@ // basic_string<charT,traits,Allocator>& // replace(size_type pos, size_type n1, const charT* s, size_type n2); -#include <stdio.h> - #include <string> #include <stdexcept> #include <algorithm> #include <cassert> +#include "test_macros.h" #include "min_allocator.h" template <class S> @@ -33,7 +32,7 @@ test(S s, typename S::size_type pos, typename S::size_type n1, try { s.replace(pos, n1, str, n2); - assert(s.__invariants()); + LIBCPP_ASSERT(s.__invariants()); assert(pos <= old_size); assert(s == expected); typename S::size_type xlen = std::min(n1, old_size - pos); diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp index e616ecc04261..d4696fba8a83 100644 --- a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp @@ -18,6 +18,7 @@ #include <algorithm> #include <cassert> +#include "test_macros.h" #include "min_allocator.h" template <class S> @@ -31,7 +32,7 @@ test(S s, typename S::size_type pos, typename S::size_type n1, try { s.replace(pos, n1, n2, c); - assert(s.__invariants()); + LIBCPP_ASSERT(s.__invariants()); assert(pos <= old_size); assert(s == expected); typename S::size_type xlen = std::min(n1, old_size - pos); diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp index ea311dd1564f..1be45d8a6624 100644 --- a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp @@ -18,6 +18,7 @@ #include <algorithm> #include <cassert> +#include "test_macros.h" #include "min_allocator.h" template <class S> @@ -29,7 +30,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expecte try { s.replace(pos1, n1, str); - assert(s.__invariants()); + LIBCPP_ASSERT(s.__invariants()); assert(pos1 <= old_size); assert(s == expected); typename S::size_type xlen = std::min(n1, old_size - pos1); diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp index 01f4a1f6ccef..3f4bf450d858 100644 --- a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp @@ -20,6 +20,7 @@ #include <algorithm> #include <cassert> +#include "test_macros.h" #include "min_allocator.h" template <class S> @@ -33,7 +34,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, try { s.replace(pos1, n1, str, pos2, n2); - assert(s.__invariants()); + LIBCPP_ASSERT(s.__invariants()); assert(pos1 <= old_size && pos2 <= str.size()); assert(s == expected); typename S::size_type xlen = std::min(n1, old_size - pos1); @@ -58,7 +59,7 @@ test_npos(S s, typename S::size_type pos1, typename S::size_type n1, try { s.replace(pos1, n1, str, pos2); - assert(s.__invariants()); + LIBCPP_ASSERT(s.__invariants()); assert(pos1 <= old_size && pos2 <= str.size()); assert(s == expected); typename S::size_type xlen = std::min(n1, old_size - pos1); |
