[libcxx] r178873 - More list debug mode tests.
Howard Hinnant
hhinnant at apple.com
Fri Apr 5 08:04:10 PDT 2013
Author: hhinnant
Date: Fri Apr 5 10:04:10 2013
New Revision: 178873
URL: http://llvm.org/viewvc/llvm-project?rev=178873&view=rev
Log:
More list debug mode tests.
Added:
libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp
libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp
libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp
libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp
libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp
libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp
Added: libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp?rev=178873&view=auto
==============================================================================
--- libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp (added)
+++ libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp Fri Apr 5 10:04:10 2013
@@ -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
Added: libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp?rev=178873&view=auto
==============================================================================
--- libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp (added)
+++ libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp Fri Apr 5 10:04:10 2013
@@ -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
Added: libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp?rev=178873&view=auto
==============================================================================
--- libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp (added)
+++ libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp Fri Apr 5 10:04:10 2013
@@ -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
Added: libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp?rev=178873&view=auto
==============================================================================
--- libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp (added)
+++ libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp Fri Apr 5 10:04:10 2013
@@ -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
Added: libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp?rev=178873&view=auto
==============================================================================
--- libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp (added)
+++ libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp Fri Apr 5 10:04:10 2013
@@ -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
Added: libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp?rev=178873&view=auto
==============================================================================
--- libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp (added)
+++ libcxx/trunk/test/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp Fri Apr 5 10:04:10 2013
@@ -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
More information about the cfe-commits
mailing list