diff options
author | Howard Hinnant <hhinnant@apple.com> | 2013-03-25 22:12:26 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2013-03-25 22:12:26 +0000 |
commit | ea1bbbd1359fbacd5bd874baf590a5c1f08429b5 (patch) | |
tree | 37b3b7668b1d7d9aa23d477c0140ea2b05ee2df8 /libcxx/test/containers/sequences/vector/db_index.pass.cpp | |
parent | a2372390970d660c277a0c41c3d15a83e8de24cf (diff) | |
download | bcm5719-llvm-ea1bbbd1359fbacd5bd874baf590a5c1f08429b5.tar.gz bcm5719-llvm-ea1bbbd1359fbacd5bd874baf590a5c1f08429b5.zip |
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
Diffstat (limited to 'libcxx/test/containers/sequences/vector/db_index.pass.cpp')
-rw-r--r-- | libcxx/test/containers/sequences/vector/db_index.pass.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
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. +// +//===----------------------------------------------------------------------===// + +// <vector> + +// Index vector out of bounds. + +#if _LIBCPP_DEBUG2 >= 1 + +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::terminate()) + +#include <vector> +#include <cassert> +#include <iterator> +#include <exception> +#include <cstdlib> + +void f1() +{ + std::exit(0); +} + +int main() +{ + std::set_terminate(f1); + typedef int T; + typedef std::vector<T> C; + C c(1); + assert(c[0] == 0); + c.clear(); + assert(c[0] == 0); + assert(false); +} + +#else + +int main() +{ +} + +#endif |