Split a few more debug mode tests missed in D100592.
Differential Revision: https://reviews.llvm.org/D102194
#include <cstdlib>
#include "test_macros.h"
-#include "min_allocator.h"
int main(int, char**)
{
- {
typedef int T;
typedef std::vector<T> 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<T, min_allocator<T>> C;
- const C c(1);
- assert(c[0] == 0);
- assert(c[1] == 0);
- assert(false);
- }
-#endif
+
+ return 0;
}
--- /dev/null
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// 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 <vector>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+ typedef int T;
+ typedef std::vector<T, min_allocator<T> > C;
+ const C c(1);
+ assert(c[0] == 0);
+ assert(c[1] == 0);
+ assert(false);
+
+ return 0;
+}
#include <exception>
#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<char, std::char_traits<char>, min_allocator<char>> S;
- S l1("123");
- S::const_iterator i = l1.end();
- l1.erase(i);
- assert(false);
- }
-#endif
+
+ return 0;
}
#include <exception>
#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<char, std::char_traits<char>, min_allocator<char>> S;
- S l1("123");
- S l2("123");
- S::const_iterator i = l2.begin();
- l1.erase(i);
- assert(false);
- }
-#endif
+
+ return 0;
}
--- /dev/null
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// 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 <string>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > S;
+ S l1("123");
+ S::const_iterator i = l1.end();
+ l1.erase(i);
+ assert(false);
+
+ return 0;
+}
--- /dev/null
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// 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 <string>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > S;
+ S l1("123");
+ S l2("123");
+ S::const_iterator i = l2.begin();
+ l1.erase(i);
+ assert(false);
+
+ return 0;
+}
#include <cstdlib>
#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<char, std::char_traits<char>, min_allocator<char>> S;
- S l1("123");
- S l2("123");
- S::iterator i = l1.erase(l2.cbegin(), l1.cbegin()+1);
- assert(false);
- }
-#endif
+
+ return 0;
}
#include <cstdlib>
#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<char, std::char_traits<char>, min_allocator<char>> S;
- S l1("123");
- S l2("123");
- S::iterator i = l1.erase(l1.cbegin(), l2.cbegin()+1);
- assert(false);
- }
-#endif
+
+ return 0;
}
#include <cstdlib>
#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<char, std::char_traits<char>, min_allocator<char>> S;
- S l1("123");
- S l2("123");
- S::iterator i = l1.erase(l2.cbegin(), l2.cbegin()+1);
- assert(false);
- }
-#endif
+
+ return 0;
}
#include <cstdlib>
#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<char, std::char_traits<char>, min_allocator<char>> S;
- S l1("123");
- S::iterator i = l1.erase(l1.cbegin()+1, l1.cbegin());
- assert(false);
- }
-#endif
+
+ return 0;
}
--- /dev/null
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// 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 <string>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > S;
+ S l1("123");
+ S l2("123");
+ S::iterator i = l1.erase(l2.cbegin(), l1.cbegin() + 1);
+ assert(false);
+
+ return 0;
+}
--- /dev/null
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// 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 <string>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > S;
+ S l1("123");
+ S l2("123");
+ S::iterator i = l1.erase(l1.cbegin(), l2.cbegin() + 1);
+ assert(false);
+
+ return 0;
+}
--- /dev/null
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// 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 <string>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > S;
+ S l1("123");
+ S l2("123");
+ S::iterator i = l1.erase(l2.cbegin(), l2.cbegin() + 1);
+ assert(false);
+
+ return 0;
+}
--- /dev/null
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// 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 <string>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > S;
+ S l1("123");
+ S::iterator i = l1.erase(l1.cbegin() + 1, l1.cbegin());
+ assert(false);
+
+ return 0;
+}