More list debug mode tests.

llvm-svn: 178873
This commit is contained in:
Howard Hinnant 2013-04-05 15:04:10 +00:00
parent 5b4267f7e7
commit 1b81829979
6 changed files with 228 additions and 0 deletions

View File

@ -0,0 +1,38 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <list>
// Call erase(const_iterator position) with end()
#if _LIBCPP_DEBUG2 >= 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
#include <cassert>
#include <cstdlib>
#include <exception>
int main()
{
int a1[] = {1, 2, 3};
std::list<int> l1(a1, a1+3);
std::list<int>::const_iterator i = l1.end();
l1.erase(i);
assert(false);
}
#else
int main()
{
}
#endif

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <list>
// Call erase(const_iterator position) with iterator from another container
#if _LIBCPP_DEBUG2 >= 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
#include <cassert>
#include <cstdlib>
#include <exception>
int main()
{
int a1[] = {1, 2, 3};
std::list<int> l1(a1, a1+3);
std::list<int> l2(a1, a1+3);
std::list<int>::const_iterator i = l2.begin();
l1.erase(i);
assert(false);
}
#else
int main()
{
}
#endif

View File

@ -0,0 +1,38 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <list>
// Call erase(const_iterator first, const_iterator last); with first iterator from another container
#if _LIBCPP_DEBUG2 >= 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
#include <cassert>
#include <exception>
#include <cstdlib>
int main()
{
int a1[] = {1, 2, 3};
std::list<int> l1(a1, a1+3);
std::list<int> l2(a1, a1+3);
std::list<int>::iterator i = l1.erase(l2.cbegin(), next(l1.cbegin()));
assert(false);
}
#else
int main()
{
}
#endif

View File

@ -0,0 +1,38 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <list>
// Call erase(const_iterator first, const_iterator last); with second iterator from another container
#if _LIBCPP_DEBUG2 >= 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
#include <cassert>
#include <exception>
#include <cstdlib>
int main()
{
int a1[] = {1, 2, 3};
std::list<int> l1(a1, a1+3);
std::list<int> l2(a1, a1+3);
std::list<int>::iterator i = l1.erase(l1.cbegin(), next(l2.cbegin()));
assert(false);
}
#else
int main()
{
}
#endif

View File

@ -0,0 +1,38 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <list>
// Call erase(const_iterator first, const_iterator last); with both iterators from another container
#if _LIBCPP_DEBUG2 >= 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
#include <cassert>
#include <exception>
#include <cstdlib>
int main()
{
int a1[] = {1, 2, 3};
std::list<int> l1(a1, a1+3);
std::list<int> l2(a1, a1+3);
std::list<int>::iterator i = l1.erase(l2.cbegin(), next(l2.cbegin()));
assert(false);
}
#else
int main()
{
}
#endif

View File

@ -0,0 +1,37 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <list>
// Call erase(const_iterator first, const_iterator last); with a bad range
#if _LIBCPP_DEBUG2 >= 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
#include <cassert>
#include <exception>
#include <cstdlib>
int main()
{
int a1[] = {1, 2, 3};
std::list<int> l1(a1, a1+3);
std::list<int>::iterator i = l1.erase(next(l1.cbegin()), l1.cbegin());
assert(false);
}
#else
int main()
{
}
#endif