[libcxx] r303899 - Add asserts that the nullptr is maintained in string erase operations.
Billy Robert O'Neal III via cfe-commits
cfe-commits at lists.llvm.org
Thu May 25 12:01:15 PDT 2017
Author: bion
Date: Thu May 25 14:01:14 2017
New Revision: 303899
URL: http://llvm.org/viewvc/llvm-project?rev=303899&view=rev
Log:
Add asserts that the nullptr is maintained in string erase operations.
Modified:
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
Modified: libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp?rev=303899&r1=303898&r2=303899&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp Thu May 25 14:01:14 2017
@@ -24,6 +24,7 @@ test(S s, typename S::difference_type po
typename S::const_iterator p = s.begin() + pos;
typename S::iterator i = s.erase(p);
LIBCPP_ASSERT(s.__invariants());
+ assert(s[s.size()] == typename S::value_type());
assert(s == expected);
assert(i - s.begin() == pos);
}
Modified: libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp?rev=303899&r1=303898&r2=303899&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp Thu May 25 14:01:14 2017
@@ -25,6 +25,7 @@ test(S s, typename S::difference_type po
typename S::const_iterator last = s.cbegin() + pos + n;
typename S::iterator i = s.erase(first, last);
LIBCPP_ASSERT(s.__invariants());
+ assert(s[s.size()] == typename S::value_type());
assert(s == expected);
assert(i - s.begin() == pos);
}
Modified: libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp?rev=303899&r1=303898&r2=303899&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp Thu May 25 14:01:14 2017
@@ -23,6 +23,7 @@ test(S s, S expected)
{
s.pop_back();
LIBCPP_ASSERT(s.__invariants());
+ assert(s[s.size()] == typename S::value_type());
assert(s == expected);
}
Modified: libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp?rev=303899&r1=303898&r2=303899&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp Thu May 25 14:01:14 2017
@@ -29,6 +29,7 @@ test(S s, typename S::size_type pos, typ
{
s.erase(pos, n);
LIBCPP_ASSERT(s.__invariants());
+ assert(s[s.size()] == typename S::value_type());
assert(s == expected);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
@@ -58,6 +59,7 @@ test(S s, typename S::size_type pos, S e
{
s.erase(pos);
LIBCPP_ASSERT(s.__invariants());
+ assert(s[s.size()] == typename S::value_type());
assert(s == expected);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
@@ -83,6 +85,7 @@ test(S s, S expected)
{
s.erase();
LIBCPP_ASSERT(s.__invariants());
+ assert(s[s.size()] == typename S::value_type());
assert(s == expected);
}
More information about the cfe-commits
mailing list