[PATCH] D33340: [libcxx] [test] Add string nullptr asserts to erase functions.

2017-05-25 Thread Billy Robert O'Neal III via Phabricator via cfe-commits
BillyONeal closed this revision.
BillyONeal added a comment.

In https://reviews.llvm.org/D33340#764206, @EricWF wrote:

> Sorry for the delay reviewing such a simple change.


No problem! Their simplicity also means no likely merge conflicts :)

In https://reviews.llvm.org/D33340#764213, @EricWF wrote:

> @BillyONeal Changes like this are good for post-commit review (ie just commit 
> it). Adding clearly correct assertions and test cases is never an 
> objectionable thing.


Sounds good, thanks!


https://reviews.llvm.org/D33340



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D33340: [libcxx] [test] Add string nullptr asserts to erase functions.

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

@BillyONeal Changes like this are good for post-commit review (ie just commit 
it). Adding clearly correct assertions and test cases is never an objectionable 
thing.


https://reviews.llvm.org/D33340



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D33340: [libcxx] [test] Add string nullptr asserts to erase functions.

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

Sorry for the delay reviewing such a simple change.


https://reviews.llvm.org/D33340



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D33340: [libcxx] [test] Add string nullptr asserts to erase functions.

2017-05-18 Thread Billy Robert O'Neal III via Phabricator via cfe-commits
BillyONeal created this revision.

In my perf overhaul for MSVC++'s basic_string I wrote the null at data[oldsize] 
instead of data[newsize]; adding asserts to catch that bug.


https://reviews.llvm.org/D33340

Files:
  test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp
  test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
  test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
  test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp


Index: 
test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
===
--- 
test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
+++ 
test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
@@ -29,6 +29,7 @@
 {
 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 @@
 {
 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 @@
 {
 s.erase();
 LIBCPP_ASSERT(s.__invariants());
+assert(s[s.size()] == typename S::value_type());
 assert(s == expected);
 }
 
Index: 
test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
===
--- 
test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
+++ 
test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
@@ -23,6 +23,7 @@
 {
 s.pop_back();
 LIBCPP_ASSERT(s.__invariants());
+assert(s[s.size()] == typename S::value_type());
 assert(s == expected);
 }
 
Index: 
test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
===
--- 
test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
+++ 
test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
@@ -25,6 +25,7 @@
 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);
 }
Index: test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp
===
--- test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp
+++ test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp
@@ -24,6 +24,7 @@
 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);
 }


Index: test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
===
--- test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
+++ test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
@@ -29,6 +29,7 @@
 {
 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 @@
 {
 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 @@
 {
 s.erase();
 LIBCPP_ASSERT(s.__invariants());
+assert(s[s.size()] == typename S::value_type());
 assert(s == expected);
 }
 
Index: test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
===
--- test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
+++ test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
@@ -23,6 +23,7 @@
 {
 s.pop_back();
 LIBCPP_ASSERT(s.__invariants());
+assert(s[s.size()] == typename S::value_type());
 assert(s == expected);
 }
 
Index: test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
===
--- test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
+++ test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
@@ -25,6 +25,7 @@
 typename S::const_iterator last = s.cbegin() + pos + n;
 typename S::iterator i = s.erase(first, last);