[libcxx-commits] [libcxx] f830664 - [libcxx][test] Split more debug mode tests

Kristina Bessonova via libcxx-commits libcxx-commits at lists.llvm.org
Tue May 11 23:28:50 PDT 2021


Author: Kristina Bessonova
Date: 2021-05-12T08:28:16+02:00
New Revision: f8306647fa05b7bf84dff12d731d03abf53b45fe

URL: https://github.com/llvm/llvm-project/commit/f8306647fa05b7bf84dff12d731d03abf53b45fe
DIFF: https://github.com/llvm/llvm-project/commit/f8306647fa05b7bf84dff12d731d03abf53b45fe.diff

LOG: [libcxx][test] Split more debug mode tests

Split a few more debug mode tests missed in D100592.

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

Added: 
    libcxx/test/libcxx/containers/sequences/vector/db_cindex_2.pass.cpp
    libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db3.pass.cpp
    libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db4.pass.cpp
    libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db5.pass.cpp
    libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db6.pass.cpp
    libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db7.pass.cpp
    libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db8.pass.cpp

Modified: 
    libcxx/test/libcxx/containers/sequences/vector/db_cindex.pass.cpp
    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_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

Removed: 
    


################################################################################
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 747300cfa28b5..ddf5a91099ea0 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 <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
index 0000000000000..2a9e4036eb689
--- /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
+//
+//===----------------------------------------------------------------------===//
+
+// <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;
+}

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 2cef4006fb13f..4c80c41e910df 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 <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;
 }

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 9ccb9195d1478..31ba0a3388296 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 <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
index 0000000000000..3effc21d5ee70
--- /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
+//
+//===----------------------------------------------------------------------===//
+
+// <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
index 0000000000000..bebbd6cbfc090
--- /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
+//
+//===----------------------------------------------------------------------===//
+
+// <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;
+}

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 9ca4b335bc247..201ecb007d818 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 <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;
 }

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 1e18285c16aa6..ca4882109f11d 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 <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;
 }

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 3ac7e8590c3ce..1409b2daa030b 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 <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;
 }

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 1d0b72dae8494..8036d31598591 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 <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
index 0000000000000..835be3590f476
--- /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
+//
+//===----------------------------------------------------------------------===//
+
+// <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
index 0000000000000..9d4d2004ecfc2
--- /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
+//
+//===----------------------------------------------------------------------===//
+
+// <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
index 0000000000000..e4f06eb9803ff
--- /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
+//
+//===----------------------------------------------------------------------===//
+
+// <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
index 0000000000000..b85b70bf2c011
--- /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
+//
+//===----------------------------------------------------------------------===//
+
+// <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;
+}


        


More information about the libcxx-commits mailing list