[libcxx][test] Split off debug mode tests
authorKristina Bessonova <kbessonova@accesssoftek.com>
Tue, 20 Apr 2021 09:58:41 +0000 (11:58 +0200)
committerKristina Bessonova <kbessonova@accesssoftek.com>
Tue, 20 Apr 2021 09:59:36 +0000 (11:59 +0200)
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

50 files changed:
libcxx/test/libcxx/containers/sequences/vector/db_back.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_back_2.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/containers/sequences/vector/db_cback.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_cback_2.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/containers/sequences/vector/db_cfront.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_cfront_2.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/containers/sequences/vector/db_front.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_front_2.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/containers/sequences/vector/db_index.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_index_2.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/containers/sequences/vector/db_iterators_10.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/containers/sequences/vector/db_iterators_11.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/containers/sequences/vector/db_iterators_12.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/containers/sequences/vector/db_iterators_13.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/containers/sequences/vector/db_iterators_14.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/containers/sequences/vector/db_iterators_15.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/containers/sequences/vector/db_iterators_2.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_iterators_3.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_iterators_4.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_iterators_5.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_iterators_6.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_iterators_7.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_iterators_8.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_iterators_9.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/strings/basic.string/string.access/db_back.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/db_back_2.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/strings/basic.string/string.access/db_cback.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/db_cback_2.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/strings/basic.string/string.access/db_cfront.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/db_cfront_2.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/strings/basic.string/string.access/db_cindex.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/db_cindex_2.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/strings/basic.string/string.access/db_front.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/db_front_2.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/strings/basic.string/string.access/db_index.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/db_index_2.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_10.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_11.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_12.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_13.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_14.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_15.pass.cpp [new file with mode: 0644]
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_2.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_3.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_4.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_5.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_6.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_7.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_8.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_9.pass.cpp [new file with mode: 0644]

index 316f5b1..5f5ab3a 100644 (file)
 #include <cstdlib>
 
 #include "test_macros.h"
-#include "min_allocator.h"
-
-int main(int, char**)
-{
-    {
-    typedef int T;
-    typedef std::vector<T> 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<T, min_allocator<T>> 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<T> 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 (file)
index 0000000..1c1656b
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// 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 <vector>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+  typedef int T;
+  typedef std::vector<T, min_allocator<T> > C;
+  C c(1);
+  assert(c.back() == 0);
+  c.clear();
+  assert(c.back() == 0);
+  assert(false);
+
+  return 0;
+}
index 87335fa..868ad0a 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;
-    assert(c.back() == 0);
-    assert(false);
-    }
-#if TEST_STD_VER >= 11
-    {
-    typedef int T;
-    typedef std::vector<T, min_allocator<T>> C;
-    const C c;
-    assert(c.back() == 0);
-    assert(false);
-    }
-#endif
+
+int main(int, char**) {
+  typedef int T;
+  typedef std::vector<T> 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 (file)
index 0000000..9f307b6
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// 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 <vector>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#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;
+  assert(c.back() == 0);
+  assert(false);
+
+  return 0;
+}
index 7e3a5c4..742b02d 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;
-    assert(c.front() == 0);
-    assert(false);
-    }
-#if TEST_STD_VER >= 11
-    {
-    typedef int T;
-    typedef std::vector<T, min_allocator<T>> C;
-    const C c;
-    assert(c.front() == 0);
-    assert(false);
-    }
-#endif
+
+int main(int, char**) {
+  typedef int T;
+  typedef std::vector<T> 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 (file)
index 0000000..adb223b
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// 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 <vector>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#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;
+  assert(c.front() == 0);
+  assert(false);
+
+  return 0;
+}
index 04ec899..e0d8189 100644 (file)
 #include <cstdlib>
 
 #include "test_macros.h"
-#include "min_allocator.h"
-
-int main(int, char**)
-{
-    {
-    typedef int T;
-    typedef std::vector<T> 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<T, min_allocator<T>> 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<T> 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 (file)
index 0000000..441bd2b
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// 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 <vector>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+  typedef int T;
+  typedef std::vector<T, min_allocator<T> > C;
+  C c(1);
+  assert(c.front() == 0);
+  c.clear();
+  assert(c.front() == 0);
+  assert(false);
+
+  return 0;
+}
index c3a0003..ad4ba72 100644 (file)
 #include <cstdlib>
 
 #include "test_macros.h"
-#include "min_allocator.h"
-
-int main(int, char**)
-{
-    {
-    typedef int T;
-    typedef std::vector<T> 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<T, min_allocator<T>> 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<T> 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 (file)
index 0000000..551fc1b
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// 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 <vector>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+  typedef int T;
+  typedef std::vector<T, min_allocator<T> > 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 (file)
index 0000000..c49cd8c
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// 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 <vector>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+  typedef int T;
+  typedef std::vector<T, min_allocator<T> > 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 (file)
index 0000000..98d7cec
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// 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 <vector>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+  typedef int T;
+  typedef std::vector<T, min_allocator<T> > 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 (file)
index 0000000..0cb183f
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// 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 <vector>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+  typedef int T;
+  typedef std::vector<T, min_allocator<T> > 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 (file)
index 0000000..dddf177
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// 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 <vector>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+  typedef int T;
+  typedef std::vector<T, min_allocator<T> > 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 (file)
index 0000000..8b66949
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// 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 <vector>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+  typedef int T;
+  typedef std::vector<T, min_allocator<T> > 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 (file)
index 0000000..07508da
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// 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 <vector>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+  typedef int T;
+  typedef std::vector<T, min_allocator<T> > C;
+  C c(1);
+  C::iterator i = c.end();
+  T j = *i;
+  (void)j;
+  assert(false);
+
+  return 0;
+}
index 91d7f75..50fdfbb 100644 (file)
 #include <cstdlib>
 
 #include "test_macros.h"
-#include "min_allocator.h"
-
-int main(int, char**)
-{
-    {
-    typedef int T;
-    typedef std::vector<T> 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<T, min_allocator<T>> 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<T> C;
+  C c1;
+  C c2;
+  bool b = c1.begin() < c2.begin();
+  (void)b;
+  assert(false);
+
+  return 0;
 }
index 24effa7..7577bbc 100644 (file)
 #include <cstdlib>
 
 #include "test_macros.h"
-#include "min_allocator.h"
-
-int main(int, char**)
-{
-    {
-    typedef int T;
-    typedef std::vector<T> 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<T, min_allocator<T>> 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<T> C;
+  C c1;
+  C c2;
+  int i = c1.begin() - c2.begin();
+  (void)i;
+  assert(false);
+
+  return 0;
 }
index 4b89b0b..b8c9c3f 100644 (file)
 #include <cstdlib>
 
 #include "test_macros.h"
-#include "min_allocator.h"
-
-int main(int, char**)
-{
-    {
-    typedef int T;
-    typedef std::vector<T> 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<T, min_allocator<T>> 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<T> C;
+  C c(1);
+  C::iterator i = c.begin();
+  assert(i[0] == 0);
+  assert(i[1] == 0);
+  assert(false);
+
+  return 0;
 }
index 33445fd..ad3dcd5 100644 (file)
 #include <cstdlib>
 
 #include "test_macros.h"
-#include "min_allocator.h"
-
-int main(int, char**)
-{
-    {
-    typedef int T;
-    typedef std::vector<T> 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<T, min_allocator<T>> 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<T> C;
+  C c(1);
+  C::iterator i = c.begin();
+  i += 1;
+  assert(i == c.end());
+  i = c.begin();
+  i += 2;
+  assert(false);
+
+  return 0;
 }
index faa065b..9460757 100644 (file)
 #include <cstdlib>
 
 #include "test_macros.h"
-#include "min_allocator.h"
-
-int main(int, char**)
-{
-    {
-    typedef int T;
-    typedef std::vector<T> 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<T, min_allocator<T>> 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<T> C;
+  C c(1);
+  C::iterator i = c.end();
+  --i;
+  assert(i == c.begin());
+  --i;
+  assert(false);
+
+  return 0;
 }
index 3ad9cf0..f93fab3 100644 (file)
 #include <cstdlib>
 
 #include "test_macros.h"
-#include "min_allocator.h"
-
-int main(int, char**)
-{
-    {
-    typedef int T;
-    typedef std::vector<T> 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<T, min_allocator<T>> 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<T> C;
+  C c(1);
+  C::iterator i = c.begin();
+  ++i;
+  assert(i == c.end());
+  ++i;
+  assert(false);
+
+  return 0;
 }
index 2d4bf20..ab4f76c 100644 (file)
 #include <cstdlib>
 
 #include "test_macros.h"
-#include "min_allocator.h"
-
-int main(int, char**)
-{
-    {
-    typedef int T;
-    typedef std::vector<T> 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<T, min_allocator<T>> 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<T> 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 (file)
index 0000000..384fdb2
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// 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 <vector>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+  typedef int T;
+  typedef std::vector<T, min_allocator<T> > C;
+  C c1;
+  C c2;
+  bool b = c1.begin() < c2.begin();
+  (void)b;
+  assert(false);
+
+  return 0;
+}
index 1332657..f5be358 100644 (file)
 #include <cstdlib>
 
 #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<char, std::char_traits<char>, min_allocator<char>> 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 (file)
index 0000000..a200b21
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// 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 <string>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#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 s(1, '\0');
+  assert(s.back() == 0);
+  s.clear();
+  assert(s.back() == 0);
+  assert(false);
+
+  return 0;
+}
index 5b80372..3a68ad2 100644 (file)
 #include <cstdlib>
 
 #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<char, std::char_traits<char>, min_allocator<char>> 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 (file)
index 0000000..8c3b344
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// 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 <string>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#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;
+  const S s;
+  assert(s.back() == 0);
+  assert(false);
+
+  return 0;
+}
index f646bf4..fd6aa9a 100644 (file)
 #include <cstdlib>
 
 #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<char, std::char_traits<char>, min_allocator<char>> 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 (file)
index 0000000..0138e17
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// 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 <string>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#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;
+  const S s;
+  assert(s.front() == 0);
+  assert(false);
+
+  return 0;
+}
index dfe2c5e..16ac79c 100644 (file)
 #include <cstdlib>
 
 #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<char, std::char_traits<char>, min_allocator<char>> 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 (file)
index 0000000..a8e2dfd
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// 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 <string>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#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;
+  const S s;
+  assert(s[0] == 0);
+  assert(s[1] == 0);
+  assert(false);
+
+  return 0;
+}
index cd47e27..9147775 100644 (file)
 #include <cstdlib>
 
 #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<char, std::char_traits<char>, min_allocator<char>> 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 (file)
index 0000000..be2232d
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// 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 <string>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#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 s(1, '\0');
+  assert(s.front() == 0);
+  s.clear();
+  assert(s.front() == 0);
+  assert(false);
+
+  return 0;
+}
index 9b1c79b..b64d901 100644 (file)
 #include <cstdlib>
 
 #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<char, std::char_traits<char>, min_allocator<char>> 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 (file)
index 0000000..2b64b36
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// 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 <string>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#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 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 (file)
index 0000000..c816310
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// 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 <string>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#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 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 (file)
index 0000000..79eec3c
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// 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 <string>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+  typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > 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 (file)
index 0000000..56966ed
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// 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 <string>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+  typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > 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 (file)
index 0000000..25f470c
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// 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 <string>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+  typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > 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 (file)
index 0000000..77df2ee
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// 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 <string>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+  typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > 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 (file)
index 0000000..e6cb93b
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// 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 <string>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+  typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > C;
+  C c(1, '\0');
+  C::iterator i = c.end();
+  (void)*i;
+  assert(false);
+
+  return 0;
+}
index 598eb75..8fcc750 100644 (file)
 #include <cstdlib>
 
 #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<char, std::char_traits<char>, min_allocator<char>> 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;
 }
index 2bdedf8..aad00ff 100644 (file)
 #include <cstdlib>
 
 #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<char, std::char_traits<char>, min_allocator<char>> 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;
 }
index 643d9cd..2fa7454 100644 (file)
 #include <cstdlib>
 
 #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<char, std::char_traits<char>, min_allocator<char>> 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;
 }
index 84daee0..4a1ed9d 100644 (file)
 #include <cstdlib>
 
 #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<char, std::char_traits<char>, min_allocator<char>> 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;
 }
index dfa7e65..2e2a9b3 100644 (file)
 #include <cstdlib>
 
 #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<char, std::char_traits<char>, min_allocator<char>> 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;
 }
index aad7f74..678c483 100644 (file)
 #include <cstdlib>
 
 #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<char, std::char_traits<char>, min_allocator<char>> 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;
 }
index 13e344b..e0bc7a4 100644 (file)
 #include <cstdlib>
 
 #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<char, std::char_traits<char>, min_allocator<char>> 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 (file)
index 0000000..27d6d35
--- /dev/null
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// 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 <string>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#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 s1;
+  S s2;
+  bool b = s1.begin() < s2.begin();
+  (void)b;
+  assert(false);
+
+  return 0;
+}