aboutsummaryrefslogtreecommitdiff
path: root/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-07-23 20:47:26 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-07-23 20:47:26 +0000
commit51072bd6bf79ef2bc6a922079bff57c31c1effbc (patch)
tree91a2effbc9e6f80bdbbf9eb70e06c51ad0867ea0 /test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
parentbb5e33f003797b67974a8893f7f2930fc51b8210 (diff)
Notes
Diffstat (limited to 'test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp')
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
index 690aebd4c2a6..e6a57519f34b 100644
--- a/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
@@ -15,6 +15,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "min_allocator.h"
@@ -23,10 +24,11 @@ void
test(S s, It first, It last, S expected)
{
s.assign(first, last);
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
template <class S, class It>
void
test_exceptions(S s, It first, It last)
@@ -35,11 +37,12 @@ test_exceptions(S s, It first, It last)
try {
s.assign(first, last);
assert(false);
- }
+ }
catch (...) {}
- assert(s.__invariants());
+ LIBCPP_ASSERT(s.__invariants());
assert(s == aCopy);
}
+#endif
int main()
{
@@ -101,7 +104,7 @@ int main()
test(S("12345678901234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+52),
S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
@@ -161,6 +164,7 @@ int main()
S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
}
#endif
+#ifndef TEST_HAS_NO_EXCEPTIONS
{ // test iterator operations that throw
typedef std::string S;
typedef ThrowingIterator<char> TIter;
@@ -174,4 +178,5 @@ int main()
test_exceptions(S(), TIter(s, s+10, 5, TIter::TADereference), TIter());
test_exceptions(S(), TIter(s, s+10, 6, TIter::TAComparison), TIter());
}
+#endif
}