[libcxx][test] Split more debug mode tests
authorKristina Bessonova <kbessonova@accesssoftek.com>
Mon, 10 May 2021 07:06:09 +0000 (09:06 +0200)
committerKristina Bessonova <kbessonova@accesssoftek.com>
Wed, 12 May 2021 06:28:16 +0000 (08:28 +0200)
Split a few more debug mode tests missed in D100592.

Differential Revision: https://reviews.llvm.org/D102194

14 files changed:
libcxx/test/libcxx/containers/sequences/vector/db_cindex.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_cindex_2.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db3.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db4.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db5.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db6.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db7.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db8.pass.cpp [new file with mode: 0644]

index 747300c..ddf5a91 100644 (file)
 #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;
 }
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 (file)
index 0000000..2a9e403
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <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;
+}
index 2cef400..4c80c41 100644 (file)
 #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;
 }
index 9ccb919..31ba0a3 100644 (file)
 #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;
 }
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 (file)
index 0000000..3effc21
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <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;
+}
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 (file)
index 0000000..bebbd6c
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <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;
+}
index 9ca4b33..201ecb0 100644 (file)
 #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;
 }
index 1e18285..ca48821 100644 (file)
 #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;
 }
index 3ac7e85..1409b2d 100644 (file)
 #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;
 }
index 1d0b72d..8036d31 100644 (file)
 #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;
 }
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 (file)
index 0000000..835be35
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <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;
+}
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 (file)
index 0000000..9d4d200
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <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;
+}
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 (file)
index 0000000..e4f06eb
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <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;
+}
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 (file)
index 0000000..b85b70b
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <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;
+}