[libc++] Add a regression test for erasing from a vector

After rebasing my trivially-relocatable branch, this behavior was broken...
but no libc++ unit test caught it! Add a regression test specifically for
erasing out of a vector.

Differential Revision: https://reviews.llvm.org/D88421
This commit is contained in:
Arthur O'Dwyer 2020-09-29 12:17:26 -04:00 committed by Louis Dionne
parent e5f047f27e
commit 7bed95a856
1 changed files with 15 additions and 0 deletions

View File

@ -35,6 +35,21 @@ bool Throws::sThrows = false;
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);