[libcxx-commits] [PATCH] D88421: Add a regression test for erasing from a vector

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Sep 29 06:47:03 PDT 2020


Quuxplusone updated this revision to Diff 294960.
Quuxplusone added a comment.

Updated with a second test for erasing from the middle of a vector.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88421/new/

https://reviews.llvm.org/D88421

Files:
  libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp


Index: libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp
===================================================================
--- libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp
+++ libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp
@@ -35,6 +35,21 @@
 
 int main(int, char**)
 {
+    {
+    int a1[] = {1, 2, 3, 4, 5};
+    std::vector<int> l1(a1, a1+5);
+    l1.erase(l1.begin());
+    assert(is_contiguous_container_asan_correct(l1));
+    assert(l1 == std::vector<int>(a1+1, a1+5));
+    }
+    {
+    int a1[] = {1, 2, 3, 4, 5};
+    int e1[] = {1, 3, 4, 5};
+    std::vector<int> l1(a1, a1+5);
+    l1.erase(l1.begin() + 1);
+    assert(is_contiguous_container_asan_correct(l1));
+    assert(l1 == std::vector<int>(e1, e1+4));
+    }
     {
     int a1[] = {1, 2, 3};
     std::vector<int> l1(a1, a1+3);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88421.294960.patch
Type: text/x-patch
Size: 903 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200929/bc20a0ad/attachment.bin>


More information about the libcxx-commits mailing list