More list debug mode tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178873 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
79a35570a5
commit
e1e96cb840
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
Loading…
x
Reference in New Issue
Block a user