Some debug test cases for list.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178565 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f6bdda044c
commit
d4c96a6c89
41
test/containers/sequences/list/db_back.pass.cpp
Normal file
41
test/containers/sequences/list/db_back.pass.cpp
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// 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 back() on empty container.
|
||||||
|
|
||||||
|
#if _LIBCPP_DEBUG2 >= 1
|
||||||
|
|
||||||
|
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
#include <cassert>
|
||||||
|
#include <iterator>
|
||||||
|
#include <exception>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
typedef int T;
|
||||||
|
typedef std::list<T> C;
|
||||||
|
C c(1);
|
||||||
|
assert(c.back() == 0);
|
||||||
|
c.clear();
|
||||||
|
assert(c.back() == 0);
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
39
test/containers/sequences/list/db_cback.pass.cpp
Normal file
39
test/containers/sequences/list/db_cback.pass.cpp
Normal 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 back() on empty const container.
|
||||||
|
|
||||||
|
#if _LIBCPP_DEBUG2 >= 1
|
||||||
|
|
||||||
|
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
#include <cassert>
|
||||||
|
#include <iterator>
|
||||||
|
#include <exception>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
typedef int T;
|
||||||
|
typedef std::list<T> C;
|
||||||
|
const C c;
|
||||||
|
assert(c.back() == 0);
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
39
test/containers/sequences/list/db_cfront.pass.cpp
Normal file
39
test/containers/sequences/list/db_cfront.pass.cpp
Normal 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 front() on empty const container.
|
||||||
|
|
||||||
|
#if _LIBCPP_DEBUG2 >= 1
|
||||||
|
|
||||||
|
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
#include <cassert>
|
||||||
|
#include <iterator>
|
||||||
|
#include <exception>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
typedef int T;
|
||||||
|
typedef std::list<T> C;
|
||||||
|
const C c;
|
||||||
|
assert(c.front() == 0);
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
41
test/containers/sequences/list/db_front.pass.cpp
Normal file
41
test/containers/sequences/list/db_front.pass.cpp
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// 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 front() on empty container.
|
||||||
|
|
||||||
|
#if _LIBCPP_DEBUG2 >= 1
|
||||||
|
|
||||||
|
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
#include <cassert>
|
||||||
|
#include <iterator>
|
||||||
|
#include <exception>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
typedef int T;
|
||||||
|
typedef std::list<T> C;
|
||||||
|
C c(1);
|
||||||
|
assert(c.front() == 0);
|
||||||
|
c.clear();
|
||||||
|
assert(c.front() == 0);
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
40
test/containers/sequences/list/db_iterators_1.pass.cpp
Normal file
40
test/containers/sequences/list/db_iterators_1.pass.cpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// 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>
|
||||||
|
|
||||||
|
// Compare iterators from different containers with == or !=.
|
||||||
|
|
||||||
|
#if _LIBCPP_DEBUG2 >= 1
|
||||||
|
|
||||||
|
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
#include <cassert>
|
||||||
|
#include <iterator>
|
||||||
|
#include <exception>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
typedef int T;
|
||||||
|
typedef std::list<T> C;
|
||||||
|
C c1;
|
||||||
|
C c2;
|
||||||
|
bool b = c1.begin() != c2.begin();
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
42
test/containers/sequences/list/db_iterators_6.pass.cpp
Normal file
42
test/containers/sequences/list/db_iterators_6.pass.cpp
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// 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>
|
||||||
|
|
||||||
|
// Decrement iterator prior to begin.
|
||||||
|
|
||||||
|
#if _LIBCPP_DEBUG2 >= 1
|
||||||
|
|
||||||
|
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
#include <cassert>
|
||||||
|
#include <iterator>
|
||||||
|
#include <exception>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
typedef int T;
|
||||||
|
typedef std::list<T> C;
|
||||||
|
C c(1);
|
||||||
|
C::iterator i = c.end();
|
||||||
|
--i;
|
||||||
|
assert(i == c.begin());
|
||||||
|
--i;
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
42
test/containers/sequences/list/db_iterators_7.pass.cpp
Normal file
42
test/containers/sequences/list/db_iterators_7.pass.cpp
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// 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>
|
||||||
|
|
||||||
|
// Increment iterator past end.
|
||||||
|
|
||||||
|
#if _LIBCPP_DEBUG2 >= 1
|
||||||
|
|
||||||
|
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
#include <cassert>
|
||||||
|
#include <iterator>
|
||||||
|
#include <exception>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
typedef int T;
|
||||||
|
typedef std::list<T> C;
|
||||||
|
C c(1);
|
||||||
|
C::iterator i = c.begin();
|
||||||
|
++i;
|
||||||
|
assert(i == c.end());
|
||||||
|
++i;
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
40
test/containers/sequences/list/db_iterators_8.pass.cpp
Normal file
40
test/containers/sequences/list/db_iterators_8.pass.cpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// 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>
|
||||||
|
|
||||||
|
// Dereference non-dereferenceable iterator.
|
||||||
|
|
||||||
|
#if _LIBCPP_DEBUG2 >= 1
|
||||||
|
|
||||||
|
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
#include <cassert>
|
||||||
|
#include <iterator>
|
||||||
|
#include <exception>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
typedef int T;
|
||||||
|
typedef std::list<T> C;
|
||||||
|
C c(1);
|
||||||
|
C::iterator i = c.end();
|
||||||
|
T j = *i;
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user