From: Kristina Bessonova Date: Mon, 10 May 2021 07:06:09 +0000 (+0200) Subject: [libcxx][test] Split more debug mode tests X-Git-Tag: llvmorg-14-init~6961 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f8306647fa05b7bf84dff12d731d03abf53b45fe;p=platform%2Fupstream%2Fllvm.git [libcxx][test] Split more debug mode tests Split a few more debug mode tests missed in D100592. Differential Revision: https://reviews.llvm.org/D102194 --- diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_cindex.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_cindex.pass.cpp index 747300c..ddf5a91 100644 --- a/libcxx/test/libcxx/containers/sequences/vector/db_cindex.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/vector/db_cindex.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; const C c(1); assert(c[0] == 0); assert(c[1] == 0); assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef int T; - typedef std::vector> C; - const C c(1); - assert(c[0] == 0); - assert(c[1] == 0); - assert(false); - } -#endif + + return 0; } diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_cindex_2.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_cindex_2.pass.cpp new file mode 100644 index 0000000..2a9e403 --- /dev/null +++ b/libcxx/test/libcxx/containers/sequences/vector/db_cindex_2.pass.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// 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 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 "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef int T; + typedef std::vector > C; + const C c(1); + assert(c[0] == 0); + assert(c[1] == 0); + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp index 2cef400..4c80c41 100644 --- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp @@ -21,23 +21,13 @@ #include #include "test_macros.h" -#include "min_allocator.h" int main(int, char**) { - { std::string l1("123"); std::string::const_iterator i = l1.end(); l1.erase(i); assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; - S l1("123"); - S::const_iterator i = l1.end(); - l1.erase(i); - assert(false); - } -#endif + + return 0; } diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp index 9ccb919..31ba0a3 100644 --- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp @@ -21,25 +21,14 @@ #include #include "test_macros.h" -#include "min_allocator.h" int main(int, char**) { - { std::string l1("123"); std::string l2("123"); std::string::const_iterator i = l2.begin(); l1.erase(i); assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; - S l1("123"); - S l2("123"); - S::const_iterator i = l2.begin(); - l1.erase(i); - assert(false); - } -#endif + + return 0; } diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db3.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db3.pass.cpp new file mode 100644 index 0000000..3effc21 --- /dev/null +++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db3.pass.cpp @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// 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 erase(const_iterator position) with 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 "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef std::basic_string, min_allocator > S; + S l1("123"); + S::const_iterator i = l1.end(); + l1.erase(i); + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db4.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db4.pass.cpp new file mode 100644 index 0000000..bebbd6c --- /dev/null +++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db4.pass.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// 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 erase(const_iterator position) with iterator from another 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 "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef std::basic_string, min_allocator > S; + S l1("123"); + S l2("123"); + S::const_iterator i = l2.begin(); + l1.erase(i); + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp index 9ca4b33..201ecb0 100644 --- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp @@ -21,23 +21,13 @@ #include #include "test_macros.h" -#include "min_allocator.h" int main(int, char**) { - { std::string l1("123"); std::string l2("123"); std::string::iterator i = l1.erase(l2.cbegin(), l1.cbegin()+1); assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; - S l1("123"); - S l2("123"); - S::iterator i = l1.erase(l2.cbegin(), l1.cbegin()+1); - assert(false); - } -#endif + + return 0; } diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp index 1e18285..ca48821 100644 --- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp @@ -21,23 +21,13 @@ #include #include "test_macros.h" -#include "min_allocator.h" int main(int, char**) { - { std::string l1("123"); std::string l2("123"); std::string::iterator i = l1.erase(l1.cbegin(), l2.cbegin()+1); assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; - S l1("123"); - S l2("123"); - S::iterator i = l1.erase(l1.cbegin(), l2.cbegin()+1); - assert(false); - } -#endif + + return 0; } diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp index 3ac7e85..1409b2d 100644 --- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp @@ -21,23 +21,13 @@ #include #include "test_macros.h" -#include "min_allocator.h" int main(int, char**) { - { std::string l1("123"); std::string l2("123"); std::string::iterator i = l1.erase(l2.cbegin(), l2.cbegin()+1); assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; - S l1("123"); - S l2("123"); - S::iterator i = l1.erase(l2.cbegin(), l2.cbegin()+1); - assert(false); - } -#endif + + return 0; } diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp index 1d0b72d..8036d31 100644 --- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp @@ -21,21 +21,12 @@ #include #include "test_macros.h" -#include "min_allocator.h" int main(int, char**) { - { std::string l1("123"); std::string::iterator i = l1.erase(l1.cbegin()+1, l1.cbegin()); assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; - S l1("123"); - S::iterator i = l1.erase(l1.cbegin()+1, l1.cbegin()); - assert(false); - } -#endif + + return 0; } diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db5.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db5.pass.cpp new file mode 100644 index 0000000..835be35 --- /dev/null +++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db5.pass.cpp @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// 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 erase(const_iterator first, const_iterator last); with first iterator from another 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 "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef std::basic_string, min_allocator > S; + S l1("123"); + S l2("123"); + S::iterator i = l1.erase(l2.cbegin(), l1.cbegin() + 1); + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db6.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db6.pass.cpp new file mode 100644 index 0000000..9d4d200 --- /dev/null +++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db6.pass.cpp @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// 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 erase(const_iterator first, const_iterator last); with second iterator from another 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 "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef std::basic_string, min_allocator > S; + S l1("123"); + S l2("123"); + S::iterator i = l1.erase(l1.cbegin(), l2.cbegin() + 1); + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db7.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db7.pass.cpp new file mode 100644 index 0000000..e4f06eb --- /dev/null +++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db7.pass.cpp @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// 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 erase(const_iterator first, const_iterator last); with both iterators from another 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 "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef std::basic_string, min_allocator > S; + S l1("123"); + S l2("123"); + S::iterator i = l1.erase(l2.cbegin(), l2.cbegin() + 1); + assert(false); + + return 0; +} diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db8.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db8.pass.cpp new file mode 100644 index 0000000..b85b70b --- /dev/null +++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db8.pass.cpp @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// 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 erase(const_iterator first, const_iterator last); with a bad range + +// 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 "test_macros.h" +#include "min_allocator.h" + +int main(int, char**) { + typedef std::basic_string, min_allocator > S; + S l1("123"); + S::iterator i = l1.erase(l1.cbegin() + 1, l1.cbegin()); + assert(false); + + return 0; +}