From 90248f2daa05f73cc5d2ca971c187d6d292c63a0 Mon Sep 17 00:00:00 2001 From: Kristina Bessonova Date: Tue, 20 Apr 2021 11:58:41 +0200 Subject: [PATCH] [libcxx][test] Split off debug mode tests This continues the work started by @ldionne in 2908eb20ba7. The debug mode tests from - libcxx/containers/sequences/vector/ - libcxx/strings/basic.string/string.access/ - libcxx/strings/basic.string/string.iterators/ similarly contain two tests in every file making the second test never run. The patch splits the tests into separate files. Reviewed By: Quuxplusone, ldionne Differential Revision: https://reviews.llvm.org/D100592 --- .../containers/sequences/vector/db_back.pass.cpp | 35 ++++++------------ .../containers/sequences/vector/db_back_2.pass.cpp | 37 +++++++++++++++++++ .../containers/sequences/vector/db_cback.pass.cpp | 29 +++++---------- .../sequences/vector/db_cback_2.pass.cpp | 35 ++++++++++++++++++ .../containers/sequences/vector/db_cfront.pass.cpp | 29 +++++---------- .../sequences/vector/db_cfront_2.pass.cpp | 35 ++++++++++++++++++ .../containers/sequences/vector/db_front.pass.cpp | 35 ++++++------------ .../sequences/vector/db_front_2.pass.cpp | 37 +++++++++++++++++++ .../containers/sequences/vector/db_index.pass.cpp | 35 ++++++------------ .../sequences/vector/db_index_2.pass.cpp | 37 +++++++++++++++++++ .../sequences/vector/db_iterators_10.pass.cpp | 37 +++++++++++++++++++ .../sequences/vector/db_iterators_11.pass.cpp | 37 +++++++++++++++++++ .../sequences/vector/db_iterators_12.pass.cpp | 39 ++++++++++++++++++++ .../sequences/vector/db_iterators_13.pass.cpp | 38 ++++++++++++++++++++ .../sequences/vector/db_iterators_14.pass.cpp | 38 ++++++++++++++++++++ .../sequences/vector/db_iterators_15.pass.cpp | 37 +++++++++++++++++++ .../sequences/vector/db_iterators_2.pass.cpp | 33 ++++++----------- .../sequences/vector/db_iterators_3.pass.cpp | 33 ++++++----------- .../sequences/vector/db_iterators_4.pass.cpp | 35 ++++++------------ .../sequences/vector/db_iterators_5.pass.cpp | 41 +++++++--------------- .../sequences/vector/db_iterators_6.pass.cpp | 38 +++++++------------- .../sequences/vector/db_iterators_7.pass.cpp | 38 +++++++------------- .../sequences/vector/db_iterators_8.pass.cpp | 33 ++++++----------- .../sequences/vector/db_iterators_9.pass.cpp | 37 +++++++++++++++++++ .../basic.string/string.access/db_back.pass.cpp | 32 ++++++----------- .../basic.string/string.access/db_back_2.pass.cpp | 36 +++++++++++++++++++ .../basic.string/string.access/db_cback.pass.cpp | 26 +++++--------- .../basic.string/string.access/db_cback_2.pass.cpp | 34 ++++++++++++++++++ .../basic.string/string.access/db_cfront.pass.cpp | 26 +++++--------- .../string.access/db_cfront_2.pass.cpp | 34 ++++++++++++++++++ .../basic.string/string.access/db_cindex.pass.cpp | 29 +++++---------- .../string.access/db_cindex_2.pass.cpp | 35 ++++++++++++++++++ .../basic.string/string.access/db_front.pass.cpp | 32 ++++++----------- .../basic.string/string.access/db_front_2.pass.cpp | 36 +++++++++++++++++++ .../basic.string/string.access/db_index.pass.cpp | 29 +++++---------- .../basic.string/string.access/db_index_2.pass.cpp | 35 ++++++++++++++++++ .../string.iterators/db_iterators_10.pass.cpp | 36 +++++++++++++++++++ .../string.iterators/db_iterators_11.pass.cpp | 36 +++++++++++++++++++ .../string.iterators/db_iterators_12.pass.cpp | 38 ++++++++++++++++++++ .../string.iterators/db_iterators_13.pass.cpp | 37 +++++++++++++++++++ .../string.iterators/db_iterators_14.pass.cpp | 37 +++++++++++++++++++ .../string.iterators/db_iterators_15.pass.cpp | 35 ++++++++++++++++++ .../string.iterators/db_iterators_2.pass.cpp | 32 ++++++----------- .../string.iterators/db_iterators_3.pass.cpp | 32 ++++++----------- .../string.iterators/db_iterators_4.pass.cpp | 32 ++++++----------- .../string.iterators/db_iterators_5.pass.cpp | 38 +++++++------------- .../string.iterators/db_iterators_6.pass.cpp | 35 ++++++------------ .../string.iterators/db_iterators_7.pass.cpp | 35 ++++++------------ .../string.iterators/db_iterators_8.pass.cpp | 29 +++++---------- .../string.iterators/db_iterators_9.pass.cpp | 36 +++++++++++++++++++ 50 files changed, 1168 insertions(+), 562 deletions(-) create mode 100644 libcxx/test/libcxx/containers/sequences/vector/db_back_2.pass.cpp create mode 100644 libcxx/test/libcxx/containers/sequences/vector/db_cback_2.pass.cpp create mode 100644 libcxx/test/libcxx/containers/sequences/vector/db_cfront_2.pass.cpp create mode 100644 libcxx/test/libcxx/containers/sequences/vector/db_front_2.pass.cpp create mode 100644 libcxx/test/libcxx/containers/sequences/vector/db_index_2.pass.cpp create mode 100644 libcxx/test/libcxx/containers/sequences/vector/db_iterators_10.pass.cpp create mode 100644 libcxx/test/libcxx/containers/sequences/vector/db_iterators_11.pass.cpp create mode 100644 libcxx/test/libcxx/containers/sequences/vector/db_iterators_12.pass.cpp create mode 100644 libcxx/test/libcxx/containers/sequences/vector/db_iterators_13.pass.cpp create mode 100644 libcxx/test/libcxx/containers/sequences/vector/db_iterators_14.pass.cpp create mode 100644 libcxx/test/libcxx/containers/sequences/vector/db_iterators_15.pass.cpp create mode 100644 libcxx/test/libcxx/containers/sequences/vector/db_iterators_9.pass.cpp create mode 100644 libcxx/test/libcxx/strings/basic.string/string.access/db_back_2.pass.cpp create mode 100644 libcxx/test/libcxx/strings/basic.string/string.access/db_cback_2.pass.cpp create mode 100644 libcxx/test/libcxx/strings/basic.string/string.access/db_cfront_2.pass.cpp create mode 100644 libcxx/test/libcxx/strings/basic.string/string.access/db_cindex_2.pass.cpp create mode 100644 libcxx/test/libcxx/strings/basic.string/string.access/db_front_2.pass.cpp create mode 100644 libcxx/test/libcxx/strings/basic.string/string.access/db_index_2.pass.cpp create mode 100644 libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_10.pass.cpp create mode 100644 libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_11.pass.cpp create mode 100644 libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_12.pass.cpp create mode 100644 libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_13.pass.cpp create mode 100644 libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_14.pass.cpp create mode 100644 libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_15.pass.cpp create mode 100644 libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_9.pass.cpp diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_back.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_back.pass.cpp index 316f5b1..5f5ab3a 100644 --- a/libcxx/test/libcxx/containers/sequences/vector/db_back.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/vector/db_back.pass.cpp @@ -22,28 +22,15 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef int T; - typedef std::vector C; - C c(1); - assert(c.back() == 0); - c.clear(); - assert(c.back() == 0); - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef int T; - typedef std::vector> C; - C c(1); - assert(c.back() == 0); - c.clear(); - assert(c.back() == 0); - assert(false); - } -#endif + +int main(int, char**) { + typedef int T; + typedef std::vector C; + C c(1); + assert(c.back() == 0); + c.clear(); + assert(c.back() == 0); + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_back_2.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_back_2.pass.cpp new file mode 100644 index 0000000..1c1656b --- /dev/null +++ b/libcxx/test/libcxx/containers/sequences/vector/db_back_2.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Call back() on empty container. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef int T; + typedef std::vector > C; + C c(1); + assert(c.back() == 0); + c.clear(); + assert(c.back() == 0); + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_cback.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_cback.pass.cpp index 87335fa..868ad0a 100644 --- a/libcxx/test/libcxx/containers/sequences/vector/db_cback.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/vector/db_cback.pass.cpp @@ -22,24 +22,13 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef int T; - typedef std::vector C; - const C c; - assert(c.back() == 0); - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef int T; - typedef std::vector> C; - const C c; - assert(c.back() == 0); - assert(false); - } -#endif + +int main(int, char**) { + typedef int T; + typedef std::vector C; + const C c; + assert(c.back() == 0); + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_cback_2.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_cback_2.pass.cpp new file mode 100644 index 0000000..9f307b6 --- /dev/null +++ b/libcxx/test/libcxx/containers/sequences/vector/db_cback_2.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Call back() on empty const container. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef int T; + typedef std::vector > C; + const C c; + assert(c.back() == 0); + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_cfront.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_cfront.pass.cpp index 7e3a5c4..742b02d 100644 --- a/libcxx/test/libcxx/containers/sequences/vector/db_cfront.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/vector/db_cfront.pass.cpp @@ -22,24 +22,13 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef int T; - typedef std::vector C; - const C c; - assert(c.front() == 0); - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef int T; - typedef std::vector> C; - const C c; - assert(c.front() == 0); - assert(false); - } -#endif + +int main(int, char**) { + typedef int T; + typedef std::vector C; + const C c; + assert(c.front() == 0); + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_cfront_2.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_cfront_2.pass.cpp new file mode 100644 index 0000000..adb223b --- /dev/null +++ b/libcxx/test/libcxx/containers/sequences/vector/db_cfront_2.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Call front() on empty const container. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef int T; + typedef std::vector > C; + const C c; + assert(c.front() == 0); + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_front.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_front.pass.cpp index 04ec899..e0d8189 100644 --- a/libcxx/test/libcxx/containers/sequences/vector/db_front.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/vector/db_front.pass.cpp @@ -22,28 +22,15 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef int T; - typedef std::vector C; - C c(1); - assert(c.front() == 0); - c.clear(); - assert(c.front() == 0); - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef int T; - typedef std::vector> C; - C c(1); - assert(c.front() == 0); - c.clear(); - assert(c.front() == 0); - assert(false); - } -#endif + +int main(int, char**) { + typedef int T; + typedef std::vector C; + C c(1); + assert(c.front() == 0); + c.clear(); + assert(c.front() == 0); + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_front_2.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_front_2.pass.cpp new file mode 100644 index 0000000..441bd2b --- /dev/null +++ b/libcxx/test/libcxx/containers/sequences/vector/db_front_2.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Call front() on empty container. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef int T; + typedef std::vector > C; + C c(1); + assert(c.front() == 0); + c.clear(); + assert(c.front() == 0); + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_index.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_index.pass.cpp index c3a0003..ad4ba72 100644 --- a/libcxx/test/libcxx/containers/sequences/vector/db_index.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/vector/db_index.pass.cpp @@ -22,28 +22,15 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef int T; - typedef std::vector C; - C c(1); - assert(c[0] == 0); - c.clear(); - assert(c[0] == 0); - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef int T; - typedef std::vector> C; - C c(1); - assert(c[0] == 0); - c.clear(); - assert(c[0] == 0); - assert(false); - } -#endif + +int main(int, char**) { + typedef int T; + typedef std::vector C; + C c(1); + assert(c[0] == 0); + c.clear(); + assert(c[0] == 0); + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_index_2.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_index_2.pass.cpp new file mode 100644 index 0000000..551fc1b --- /dev/null +++ b/libcxx/test/libcxx/containers/sequences/vector/db_index_2.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Index vector out of bounds. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef int T; + typedef std::vector > C; + C c(1); + assert(c[0] == 0); + c.clear(); + assert(c[0] == 0); + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_10.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_10.pass.cpp new file mode 100644 index 0000000..c49cd8c --- /dev/null +++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_10.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Subtract iterators from different containers. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef int T; + typedef std::vector > C; + C c1; + C c2; + int i = c1.begin() - c2.begin(); + (void)i; + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_11.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_11.pass.cpp new file mode 100644 index 0000000..98d7cec --- /dev/null +++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_11.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Index iterator out of bounds. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef int T; + typedef std::vector > C; + C c(1); + C::iterator i = c.begin(); + assert(i[0] == 0); + assert(i[1] == 0); + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_12.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_12.pass.cpp new file mode 100644 index 0000000..0cb183f --- /dev/null +++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_12.pass.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Add to iterator out of bounds. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef int T; + typedef std::vector > C; + C c(1); + C::iterator i = c.begin(); + i += 1; + assert(i == c.end()); + i = c.begin(); + i += 2; + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_13.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_13.pass.cpp new file mode 100644 index 0000000..dddf177 --- /dev/null +++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_13.pass.cpp @@ -0,0 +1,38 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Decrement iterator prior to begin. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef int T; + typedef std::vector > C; + C c(1); + C::iterator i = c.end(); + --i; + assert(i == c.begin()); + --i; + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_14.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_14.pass.cpp new file mode 100644 index 0000000..8b66949 --- /dev/null +++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_14.pass.cpp @@ -0,0 +1,38 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Increment iterator past end. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef int T; + typedef std::vector > C; + C c(1); + C::iterator i = c.begin(); + ++i; + assert(i == c.end()); + ++i; + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_15.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_15.pass.cpp new file mode 100644 index 0000000..07508da --- /dev/null +++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_15.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Dereference non-dereferenceable iterator. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef int T; + typedef std::vector > C; + C c(1); + C::iterator i = c.end(); + T j = *i; + (void)j; + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_2.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_2.pass.cpp index 91d7f75..50fdfbb 100644 --- a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_2.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_2.pass.cpp @@ -22,26 +22,15 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef int T; - typedef std::vector C; - C c1; - C c2; - bool b = c1.begin() < c2.begin(); (void)b; - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef int T; - typedef std::vector> C; - C c1; - C c2; - bool b = c1.begin() < c2.begin(); (void)b; - assert(false); - } -#endif + +int main(int, char**) { + typedef int T; + typedef std::vector C; + C c1; + C c2; + bool b = c1.begin() < c2.begin(); + (void)b; + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_3.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_3.pass.cpp index 24effa7..7577bbc 100644 --- a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_3.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_3.pass.cpp @@ -22,26 +22,15 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef int T; - typedef std::vector C; - C c1; - C c2; - int i = c1.begin() - c2.begin(); (void)i; - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef int T; - typedef std::vector> C; - C c1; - C c2; - int i = c1.begin() - c2.begin(); (void)i; - assert(false); - } -#endif + +int main(int, char**) { + typedef int T; + typedef std::vector C; + C c1; + C c2; + int i = c1.begin() - c2.begin(); + (void)i; + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_4.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_4.pass.cpp index 4b89b0b..b8c9c3f 100644 --- a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_4.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_4.pass.cpp @@ -22,28 +22,15 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef int T; - typedef std::vector C; - C c(1); - C::iterator i = c.begin(); - assert(i[0] == 0); - assert(i[1] == 0); - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef int T; - typedef std::vector> C; - C c(1); - C::iterator i = c.begin(); - assert(i[0] == 0); - assert(i[1] == 0); - assert(false); - } -#endif + +int main(int, char**) { + typedef int T; + typedef std::vector C; + C c(1); + C::iterator i = c.begin(); + assert(i[0] == 0); + assert(i[1] == 0); + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_5.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_5.pass.cpp index 33445fd..ad3dcd5 100644 --- a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_5.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_5.pass.cpp @@ -22,32 +22,17 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef int T; - typedef std::vector C; - C c(1); - C::iterator i = c.begin(); - i += 1; - assert(i == c.end()); - i = c.begin(); - i += 2; - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef int T; - typedef std::vector> C; - C c(1); - C::iterator i = c.begin(); - i += 1; - assert(i == c.end()); - i = c.begin(); - i += 2; - assert(false); - } -#endif + +int main(int, char**) { + typedef int T; + typedef std::vector C; + C c(1); + C::iterator i = c.begin(); + i += 1; + assert(i == c.end()); + i = c.begin(); + i += 2; + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_6.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_6.pass.cpp index faa065b..946075734 100644 --- a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_6.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_6.pass.cpp @@ -22,30 +22,16 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef int T; - typedef std::vector C; - C c(1); - C::iterator i = c.end(); - --i; - assert(i == c.begin()); - --i; - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef int T; - typedef std::vector> C; - C c(1); - C::iterator i = c.end(); - --i; - assert(i == c.begin()); - --i; - assert(false); - } -#endif + +int main(int, char**) { + typedef int T; + typedef std::vector C; + C c(1); + C::iterator i = c.end(); + --i; + assert(i == c.begin()); + --i; + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_7.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_7.pass.cpp index 3ad9cf0..f93fab3 100644 --- a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_7.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_7.pass.cpp @@ -22,30 +22,16 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef int T; - typedef std::vector C; - C c(1); - C::iterator i = c.begin(); - ++i; - assert(i == c.end()); - ++i; - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef int T; - typedef std::vector> C; - C c(1); - C::iterator i = c.begin(); - ++i; - assert(i == c.end()); - ++i; - assert(false); - } -#endif + +int main(int, char**) { + typedef int T; + typedef std::vector C; + C c(1); + C::iterator i = c.begin(); + ++i; + assert(i == c.end()); + ++i; + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_8.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_8.pass.cpp index 2d4bf20..ab4f76c 100644 --- a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_8.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_8.pass.cpp @@ -22,26 +22,15 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef int T; - typedef std::vector C; - C c(1); - C::iterator i = c.end(); - T j = *i; (void)j; - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef int T; - typedef std::vector> C; - C c(1); - C::iterator i = c.end(); - T j = *i; (void)j; - assert(false); - } -#endif + +int main(int, char**) { + typedef int T; + typedef std::vector C; + C c(1); + C::iterator i = c.end(); + T j = *i; + (void)j; + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_9.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_9.pass.cpp new file mode 100644 index 0000000..384fdb2 --- /dev/null +++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_9.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Compare iterators from different containers with <. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef int T; + typedef std::vector > C; + C c1; + C c2; + bool b = c1.begin() < c2.begin(); + (void)b; + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_back.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_back.pass.cpp index 1332657..f5be358 100644 --- a/libcxx/test/libcxx/strings/basic.string/string.access/db_back.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_back.pass.cpp @@ -22,26 +22,14 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef std::string S; - S s(1, '\0'); - assert(s.back() == 0); - s.clear(); - assert(s.back() == 0); - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; - S s(1, '\0'); - assert(s.back() == 0); - s.clear(); - assert(s.back() == 0); - assert(false); - } -#endif + +int main(int, char**) { + typedef std::string S; + S s(1, '\0'); + assert(s.back() == 0); + s.clear(); + assert(s.back() == 0); + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_back_2.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_back_2.pass.cpp new file mode 100644 index 0000000..a200b21 --- /dev/null +++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_back_2.pass.cpp @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Call back() on empty container. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef std::basic_string, min_allocator > S; + S s(1, '\0'); + assert(s.back() == 0); + s.clear(); + assert(s.back() == 0); + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_cback.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_cback.pass.cpp index 5b80372..3a68ad2 100644 --- a/libcxx/test/libcxx/strings/basic.string/string.access/db_cback.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_cback.pass.cpp @@ -22,22 +22,12 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef std::string S; - const S s; - assert(s.back() == 0); - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; - const S s; - assert(s.back() == 0); - assert(false); - } -#endif + +int main(int, char**) { + typedef std::string S; + const S s; + assert(s.back() == 0); + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_cback_2.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_cback_2.pass.cpp new file mode 100644 index 0000000..8c3b344 --- /dev/null +++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_cback_2.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Call back() on empty const container. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef std::basic_string, min_allocator > S; + const S s; + assert(s.back() == 0); + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_cfront.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_cfront.pass.cpp index f646bf4..fd6aa9a 100644 --- a/libcxx/test/libcxx/strings/basic.string/string.access/db_cfront.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_cfront.pass.cpp @@ -22,22 +22,12 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef std::string S; - const S s; - assert(s.front() == 0); - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; - const S s; - assert(s.front() == 0); - assert(false); - } -#endif + +int main(int, char**) { + typedef std::string S; + const S s; + assert(s.front() == 0); + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_cfront_2.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_cfront_2.pass.cpp new file mode 100644 index 0000000..0138e17 --- /dev/null +++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_cfront_2.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Call front() on empty const container. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef std::basic_string, min_allocator > S; + const S s; + assert(s.front() == 0); + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_cindex.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_cindex.pass.cpp index dfe2c5e..16ac79c 100644 --- a/libcxx/test/libcxx/strings/basic.string/string.access/db_cindex.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_cindex.pass.cpp @@ -22,24 +22,13 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef std::string S; - const S s; - assert(s[0] == 0); - assert(s[1] == 0); - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; - const S s; - assert(s[0] == 0); - assert(s[1] == 0); - assert(false); - } -#endif + +int main(int, char**) { + typedef std::string S; + const S s; + assert(s[0] == 0); + assert(s[1] == 0); + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_cindex_2.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_cindex_2.pass.cpp new file mode 100644 index 0000000..a8e2dfd --- /dev/null +++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_cindex_2.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Index const string out of bounds. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef std::basic_string, min_allocator > S; + const S s; + assert(s[0] == 0); + assert(s[1] == 0); + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_front.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_front.pass.cpp index cd47e27..9147775 100644 --- a/libcxx/test/libcxx/strings/basic.string/string.access/db_front.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_front.pass.cpp @@ -22,26 +22,14 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef std::string S; - S s(1, '\0'); - assert(s.front() == 0); - s.clear(); - assert(s.front() == 0); - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; - S s(1, '\0'); - assert(s.front() == 0); - s.clear(); - assert(s.front() == 0); - assert(false); - } -#endif + +int main(int, char**) { + typedef std::string S; + S s(1, '\0'); + assert(s.front() == 0); + s.clear(); + assert(s.front() == 0); + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_front_2.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_front_2.pass.cpp new file mode 100644 index 0000000..be2232d --- /dev/null +++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_front_2.pass.cpp @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Call front() on empty container. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef std::basic_string, min_allocator > S; + S s(1, '\0'); + assert(s.front() == 0); + s.clear(); + assert(s.front() == 0); + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_index.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_index.pass.cpp index 9b1c79b..b64d901 100644 --- a/libcxx/test/libcxx/strings/basic.string/string.access/db_index.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_index.pass.cpp @@ -22,24 +22,13 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef std::string S; - S s; - assert(s[0] == 0); - assert(s[1] == 0); - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; - S s; - assert(s[0] == 0); - assert(s[1] == 0); - assert(false); - } -#endif + +int main(int, char**) { + typedef std::string S; + S s; + assert(s[0] == 0); + assert(s[1] == 0); + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_index_2.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_index_2.pass.cpp new file mode 100644 index 0000000..2b64b36 --- /dev/null +++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_index_2.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Index string out of bounds. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef std::basic_string, min_allocator > S; + S s; + assert(s[0] == 0); + assert(s[1] == 0); + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_10.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_10.pass.cpp new file mode 100644 index 0000000..c816310 --- /dev/null +++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_10.pass.cpp @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Subtract iterators from different containers with <. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef std::basic_string, min_allocator > S; + S s1; + S s2; + int i = s1.begin() - s2.begin(); + (void)i; + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_11.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_11.pass.cpp new file mode 100644 index 0000000..79eec3c --- /dev/null +++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_11.pass.cpp @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Index iterator out of bounds. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef std::basic_string, min_allocator > C; + C c(1, '\0'); + C::iterator i = c.begin(); + assert(i[0] == 0); + assert(i[1] == 0); + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_12.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_12.pass.cpp new file mode 100644 index 0000000..56966ed --- /dev/null +++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_12.pass.cpp @@ -0,0 +1,38 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Add to iterator out of bounds. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef std::basic_string, min_allocator > C; + C c(1, '\0'); + C::iterator i = c.begin(); + i += 1; + assert(i == c.end()); + i = c.begin(); + i += 2; + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_13.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_13.pass.cpp new file mode 100644 index 0000000..25f470c --- /dev/null +++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_13.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Decrement iterator prior to begin. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef std::basic_string, min_allocator > C; + C c(1, '\0'); + C::iterator i = c.end(); + --i; + assert(i == c.begin()); + --i; + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_14.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_14.pass.cpp new file mode 100644 index 0000000..77df2ee --- /dev/null +++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_14.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Increment iterator past end. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef std::basic_string, min_allocator > C; + C c(1, '\0'); + C::iterator i = c.begin(); + ++i; + assert(i == c.end()); + ++i; + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_15.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_15.pass.cpp new file mode 100644 index 0000000..e6cb93b --- /dev/null +++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_15.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Dereference non-dereferenceable iterator. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef std::basic_string, min_allocator > C; + C c(1, '\0'); + C::iterator i = c.end(); + (void)*i; + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_2.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_2.pass.cpp index 598eb75..8fcc750 100644 --- a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_2.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_2.pass.cpp @@ -22,26 +22,14 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef std::string S; - S s1; - S s2; - bool b = s1.begin() < s2.begin(); - (void) b; - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; - S s1; - S s2; - bool b = s1.begin() < s2.begin(); - (void) b; - assert(false); - } -#endif + +int main(int, char**) { + typedef std::string S; + S s1; + S s2; + bool b = s1.begin() < s2.begin(); + (void)b; + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_3.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_3.pass.cpp index 2bdedf8..aad00ff 100644 --- a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_3.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_3.pass.cpp @@ -22,26 +22,14 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef std::string S; - S s1; - S s2; - int i = s1.begin() - s2.begin(); - (void) i; - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; - S s1; - S s2; - int i = s1.begin() - s2.begin(); - (void) i; - assert(false); - } -#endif + +int main(int, char**) { + typedef std::string S; + S s1; + S s2; + int i = s1.begin() - s2.begin(); + (void)i; + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_4.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_4.pass.cpp index 643d9cd..2fa7454 100644 --- a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_4.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_4.pass.cpp @@ -22,26 +22,14 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef std::string C; - C c(1, '\0'); - C::iterator i = c.begin(); - assert(i[0] == 0); - assert(i[1] == 0); - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> C; - C c(1, '\0'); - C::iterator i = c.begin(); - assert(i[0] == 0); - assert(i[1] == 0); - assert(false); - } -#endif + +int main(int, char**) { + typedef std::string C; + C c(1, '\0'); + C::iterator i = c.begin(); + assert(i[0] == 0); + assert(i[1] == 0); + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_5.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_5.pass.cpp index 84daee0..4a1ed9d 100644 --- a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_5.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_5.pass.cpp @@ -22,30 +22,16 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef std::string C; - C c(1, '\0'); - C::iterator i = c.begin(); - i += 1; - assert(i == c.end()); - i = c.begin(); - i += 2; - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> C; - C c(1, '\0'); - C::iterator i = c.begin(); - i += 1; - assert(i == c.end()); - i = c.begin(); - i += 2; - assert(false); - } -#endif + +int main(int, char**) { + typedef std::string C; + C c(1, '\0'); + C::iterator i = c.begin(); + i += 1; + assert(i == c.end()); + i = c.begin(); + i += 2; + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_6.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_6.pass.cpp index dfa7e65..2e2a9b3 100644 --- a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_6.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_6.pass.cpp @@ -22,28 +22,15 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef std::string C; - C c(1, '\0'); - C::iterator i = c.end(); - --i; - assert(i == c.begin()); - --i; - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> C; - C c(1, '\0'); - C::iterator i = c.end(); - --i; - assert(i == c.begin()); - --i; - assert(false); - } -#endif + +int main(int, char**) { + typedef std::string C; + C c(1, '\0'); + C::iterator i = c.end(); + --i; + assert(i == c.begin()); + --i; + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_7.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_7.pass.cpp index aad7f74..678c483 100644 --- a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_7.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_7.pass.cpp @@ -22,28 +22,15 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef std::string C; - C c(1, '\0'); - C::iterator i = c.begin(); - ++i; - assert(i == c.end()); - ++i; - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> C; - C c(1, '\0'); - C::iterator i = c.begin(); - ++i; - assert(i == c.end()); - ++i; - assert(false); - } -#endif + +int main(int, char**) { + typedef std::string C; + C c(1, '\0'); + C::iterator i = c.begin(); + ++i; + assert(i == c.end()); + ++i; + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_8.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_8.pass.cpp index 13e344b..e0bc7a4 100644 --- a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_8.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_8.pass.cpp @@ -22,24 +22,13 @@ #include #include "test_macros.h" -#include "min_allocator.h" - -int main(int, char**) -{ - { - typedef std::string C; - C c(1, '\0'); - C::iterator i = c.end(); - (void) *i; - assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> C; - C c(1, '\0'); - C::iterator i = c.end(); - (void) *i; - assert(false); - } -#endif + +int main(int, char**) { + typedef std::string C; + C c(1, '\0'); + C::iterator i = c.end(); + (void)*i; + assert(false); + + return 0; } diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_9.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_9.pass.cpp new file mode 100644 index 0000000..27d6d35 --- /dev/null +++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_9.pass.cpp @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// Compare iterators from different containers with <. + +// UNSUPPORTED: libcxx-no-debug-mode + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef std::basic_string, min_allocator > S; + S s1; + S s2; + bool b = s1.begin() < s2.begin(); + (void)b; + assert(false); + + return 0; +} -- 2.7.4