From ea1bbbd1359fbacd5bd874baf590a5c1f08429b5 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Mon, 25 Mar 2013 22:12:26 +0000 Subject: Added debug tests for indexing, pop_back and both forms of erase. Added an improved error message for erasing a single element with end(). llvm-svn: 177929 --- .../containers/sequences/vector/db_index.pass.cpp | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 libcxx/test/containers/sequences/vector/db_index.pass.cpp (limited to 'libcxx/test/containers/sequences/vector/db_index.pass.cpp') diff --git a/libcxx/test/containers/sequences/vector/db_index.pass.cpp b/libcxx/test/containers/sequences/vector/db_index.pass.cpp new file mode 100644 index 00000000000..e906decc796 --- /dev/null +++ b/libcxx/test/containers/sequences/vector/db_index.pass.cpp @@ -0,0 +1,47 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// Index vector out of bounds. + +#if _LIBCPP_DEBUG2 >= 1 + +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::terminate()) + +#include +#include +#include +#include +#include + +void f1() +{ + std::exit(0); +} + +int main() +{ + std::set_terminate(f1); + typedef int T; + typedef std::vector C; + C c(1); + assert(c[0] == 0); + c.clear(); + assert(c[0] == 0); + assert(false); +} + +#else + +int main() +{ +} + +#endif -- cgit v1.2.3