[libcxx-commits] [libcxx] 0efd9a0 - [libc++] [test] Refactor string_view comparison tests for comprehensiveness.
Arthur O'Dwyer via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Dec 1 12:05:26 PST 2021
Author: Arthur O'Dwyer
Date: 2021-12-01T15:04:33-05:00
New Revision: 0efd9a03fa643fad42b222c9fb8a417da3f5b0d6
URL: https://github.com/llvm/llvm-project/commit/0efd9a03fa643fad42b222c9fb8a417da3f5b0d6
DIFF: https://github.com/llvm/llvm-project/commit/0efd9a03fa643fad42b222c9fb8a417da3f5b0d6.diff
LOG: [libc++] [test] Refactor string_view comparison tests for comprehensiveness.
Differential Revision: https://reviews.llvm.org/D114658
Added:
libcxx/test/std/strings/string.view/string.view.comparison/equal.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/greater.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/greater_equal.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/less.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/less_equal.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/not_equal.pass.cpp
Modified:
Removed:
libcxx/test/std/strings/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/opeq.string_view.string.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/opge.string_view.string.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/opgt.string_view.string.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/ople.string_view.string.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/oplt.string_view.string.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/opne.string_view.string.pass.cpp
libcxx/test/std/strings/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp
################################################################################
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/equal.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/equal.pass.cpp
new file mode 100644
index 0000000000000..4aa27b0b99caa
--- /dev/null
+++ b/libcxx/test/std/strings/string.view/string.view.comparison/equal.pass.cpp
@@ -0,0 +1,116 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_view>
+
+// template<class charT, class traits>
+// constexpr bool operator==(basic_string_view<charT, traits> lhs, basic_string_view<charT, traits> rhs);
+// (plus "sufficient additional overloads" to make implicit conversions work as intended)
+
+#include <string_view>
+#include <cassert>
+#include <string>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.h"
+#include "make_string.h"
+
+template<class T>
+struct ConvertibleTo {
+ T t_;
+ TEST_CONSTEXPR explicit ConvertibleTo(T t) : t_(t) {}
+ TEST_CONSTEXPR operator T() const {
+ return t_;
+ }
+};
+
+template<class SV>
+TEST_CONSTEXPR_CXX14 bool test()
+{
+ typedef typename SV::value_type CharT;
+ typedef typename SV::traits_type Traits;
+
+ // Test the behavior of the operator, both with and without implicit conversions.
+ SV v[] = {
+ SV(MAKE_CSTRING(CharT, "")),
+ SV(MAKE_CSTRING(CharT, "abc")),
+ SV(MAKE_CSTRING(CharT, "abcdef")),
+ SV(MAKE_CSTRING(CharT, "acb")),
+ };
+ for (int i = 0; i < 4; ++i) {
+ for (int j = 0; j < 4; ++j) {
+ // See http://eel.is/c++draft/string.view#tab:string.view.comparison.overloads
+ bool expected = (i == j);
+ assert((v[i] == v[j]) == expected);
+ assert((v[i].data() == v[j]) == expected);
+ assert((v[i] == v[j].data()) == expected);
+ assert((ConvertibleTo<SV>(v[i]) == v[j]) == expected);
+ assert((v[i] == ConvertibleTo<SV>(v[j])) == expected);
+
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ // TODO FIXME: once P0980 "Making std::string constexpr" is implemented
+ assert((std::basic_string<CharT, Traits>(v[i]) == v[j]) == expected);
+ assert((v[i] == std::basic_string<CharT, Traits>(v[j])) == expected);
+ }
+ }
+ }
+
+ // Test its behavior with embedded null bytes.
+ SV abc = SV(MAKE_CSTRING(CharT, "abc"));
+ SV abc0def = SV(MAKE_CSTRING(CharT, "abc\0def"), 7);
+ SV abcdef = SV(MAKE_CSTRING(CharT, "abcdef"));
+ assert((abc == abc0def) == false);
+ assert((abc == abcdef) == false);
+ assert((abc0def == abc) == false);
+ assert((abc0def == abcdef) == false);
+ assert((abcdef == abc) == false);
+ assert((abcdef == abc0def) == false);
+
+ assert((abc.data() == abc0def) == false);
+ assert((abc0def == abc.data()) == false);
+
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ // TODO FIXME: once P0980 "Making std::string constexpr" is implemented
+ assert((std::basic_string<CharT, Traits>(abc) == abc0def) == false);
+ assert((abc0def == std::basic_string<CharT, Traits>(abc)) == false);
+ }
+
+ return true;
+}
+
+int main(int, char**)
+{
+ test<std::string_view>();
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
+ test<std::wstring_view>();
+#endif
+#if TEST_STD_VER >= 11
+ test<std::u16string_view>();
+ test<std::u32string_view>();
+#endif
+#if TEST_STD_VER > 14
+ static_assert(test<std::string_view>(), "");
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
+ static_assert(test<std::wstring_view>(), "");
+#endif
+ static_assert(test<std::u16string_view>(), "");
+ static_assert(test<std::u32string_view>(), "");
+#endif
+
+#if TEST_STD_VER > 11
+ test<std::basic_string_view<char, constexpr_char_traits<char>>>();
+ static_assert(test<std::basic_string_view<char, constexpr_char_traits<char>>>(), "");
+#endif
+
+#if TEST_STD_VER > 17
+ test<std::u8string_view>();
+ static_assert(test<std::u8string_view>());
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/greater.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/greater.pass.cpp
new file mode 100644
index 0000000000000..84753b04e1965
--- /dev/null
+++ b/libcxx/test/std/strings/string.view/string.view.comparison/greater.pass.cpp
@@ -0,0 +1,116 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_view>
+
+// template<class charT, class traits>
+// constexpr bool operator>(basic_string_view<charT, traits> lhs, basic_string_view<charT, traits> rhs);
+// (plus "sufficient additional overloads" to make implicit conversions work as intended)
+
+#include <string_view>
+#include <cassert>
+#include <string>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.h"
+#include "make_string.h"
+
+template<class T>
+struct ConvertibleTo {
+ T t_;
+ TEST_CONSTEXPR explicit ConvertibleTo(T t) : t_(t) {}
+ TEST_CONSTEXPR operator T() const {
+ return t_;
+ }
+};
+
+template<class SV>
+TEST_CONSTEXPR_CXX14 bool test()
+{
+ typedef typename SV::value_type CharT;
+ typedef typename SV::traits_type Traits;
+
+ // Test the behavior of the operator, both with and without implicit conversions.
+ SV v[] = {
+ SV(MAKE_CSTRING(CharT, "")),
+ SV(MAKE_CSTRING(CharT, "abc")),
+ SV(MAKE_CSTRING(CharT, "abcdef")),
+ SV(MAKE_CSTRING(CharT, "acb")),
+ };
+ for (int i = 0; i < 4; ++i) {
+ for (int j = 0; j < 4; ++j) {
+ // See http://eel.is/c++draft/string.view#tab:string.view.comparison.overloads
+ bool expected = (i > j);
+ assert((v[i] > v[j]) == expected);
+ assert((v[i].data() > v[j]) == expected);
+ assert((v[i] > v[j].data()) == expected);
+ assert((ConvertibleTo<SV>(v[i]) > v[j]) == expected);
+ assert((v[i] > ConvertibleTo<SV>(v[j])) == expected);
+
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ // TODO FIXME: once P0980 "Making std::string constexpr" is implemented
+ assert((std::basic_string<CharT, Traits>(v[i]) > v[j]) == expected);
+ assert((v[i] > std::basic_string<CharT, Traits>(v[j])) == expected);
+ }
+ }
+ }
+
+ // Test its behavior with embedded null bytes.
+ SV abc = SV(MAKE_CSTRING(CharT, "abc"));
+ SV abc0def = SV(MAKE_CSTRING(CharT, "abc\0def"), 7);
+ SV abcdef = SV(MAKE_CSTRING(CharT, "abcdef"));
+ assert((abc > abc0def) == false);
+ assert((abc > abcdef) == false);
+ assert((abc0def > abc) == true);
+ assert((abc0def > abcdef) == false);
+ assert((abcdef > abc) == true);
+ assert((abcdef > abc0def) == true);
+
+ assert((abc.data() > abc0def) == false);
+ assert((abc0def > abc.data()) == true);
+
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ // TODO FIXME: once P0980 "Making std::string constexpr" is implemented
+ assert((std::basic_string<CharT, Traits>(abc) > abc0def) == false);
+ assert((abc0def > std::basic_string<CharT, Traits>(abc)) == true);
+ }
+
+ return true;
+}
+
+int main(int, char**)
+{
+ test<std::string_view>();
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
+ test<std::wstring_view>();
+#endif
+#if TEST_STD_VER >= 11
+ test<std::u16string_view>();
+ test<std::u32string_view>();
+#endif
+#if TEST_STD_VER > 14
+ static_assert(test<std::string_view>(), "");
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
+ static_assert(test<std::wstring_view>(), "");
+#endif
+ static_assert(test<std::u16string_view>(), "");
+ static_assert(test<std::u32string_view>(), "");
+#endif
+
+#if TEST_STD_VER > 11
+ test<std::basic_string_view<char, constexpr_char_traits<char>>>();
+ static_assert(test<std::basic_string_view<char, constexpr_char_traits<char>>>(), "");
+#endif
+
+#if TEST_STD_VER > 17
+ test<std::u8string_view>();
+ static_assert(test<std::u8string_view>());
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/greater_equal.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/greater_equal.pass.cpp
new file mode 100644
index 0000000000000..0ae1b6ff86441
--- /dev/null
+++ b/libcxx/test/std/strings/string.view/string.view.comparison/greater_equal.pass.cpp
@@ -0,0 +1,116 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_view>
+
+// template<class charT, class traits>
+// constexpr bool operator>=(basic_string_view<charT, traits> lhs, basic_string_view<charT, traits> rhs);
+// (plus "sufficient additional overloads" to make implicit conversions work as intended)
+
+#include <string_view>
+#include <cassert>
+#include <string>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.h"
+#include "make_string.h"
+
+template<class T>
+struct ConvertibleTo {
+ T t_;
+ TEST_CONSTEXPR explicit ConvertibleTo(T t) : t_(t) {}
+ TEST_CONSTEXPR operator T() const {
+ return t_;
+ }
+};
+
+template<class SV>
+TEST_CONSTEXPR_CXX14 bool test()
+{
+ typedef typename SV::value_type CharT;
+ typedef typename SV::traits_type Traits;
+
+ // Test the behavior of the operator, both with and without implicit conversions.
+ SV v[] = {
+ SV(MAKE_CSTRING(CharT, "")),
+ SV(MAKE_CSTRING(CharT, "abc")),
+ SV(MAKE_CSTRING(CharT, "abcdef")),
+ SV(MAKE_CSTRING(CharT, "acb")),
+ };
+ for (int i = 0; i < 4; ++i) {
+ for (int j = 0; j < 4; ++j) {
+ // See http://eel.is/c++draft/string.view#tab:string.view.comparison.overloads
+ bool expected = (i >= j);
+ assert((v[i] >= v[j]) == expected);
+ assert((v[i].data() >= v[j]) == expected);
+ assert((v[i] >= v[j].data()) == expected);
+ assert((ConvertibleTo<SV>(v[i]) >= v[j]) == expected);
+ assert((v[i] >= ConvertibleTo<SV>(v[j])) == expected);
+
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ // TODO FIXME: once P0980 "Making std::string constexpr" is implemented
+ assert((std::basic_string<CharT, Traits>(v[i]) >= v[j]) == expected);
+ assert((v[i] >= std::basic_string<CharT, Traits>(v[j])) == expected);
+ }
+ }
+ }
+
+ // Test its behavior with embedded null bytes.
+ SV abc = SV(MAKE_CSTRING(CharT, "abc"));
+ SV abc0def = SV(MAKE_CSTRING(CharT, "abc\0def"), 7);
+ SV abcdef = SV(MAKE_CSTRING(CharT, "abcdef"));
+ assert((abc >= abc0def) == false);
+ assert((abc >= abcdef) == false);
+ assert((abc0def >= abc) == true);
+ assert((abc0def >= abcdef) == false);
+ assert((abcdef >= abc) == true);
+ assert((abcdef >= abc0def) == true);
+
+ assert((abc.data() >= abc0def) == false);
+ assert((abc0def >= abc.data()) == true);
+
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ // TODO FIXME: once P0980 "Making std::string constexpr" is implemented
+ assert((std::basic_string<CharT, Traits>(abc) >= abc0def) == false);
+ assert((abc0def >= std::basic_string<CharT, Traits>(abc)) == true);
+ }
+
+ return true;
+}
+
+int main(int, char**)
+{
+ test<std::string_view>();
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
+ test<std::wstring_view>();
+#endif
+#if TEST_STD_VER >= 11
+ test<std::u16string_view>();
+ test<std::u32string_view>();
+#endif
+#if TEST_STD_VER > 14
+ static_assert(test<std::string_view>(), "");
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
+ static_assert(test<std::wstring_view>(), "");
+#endif
+ static_assert(test<std::u16string_view>(), "");
+ static_assert(test<std::u32string_view>(), "");
+#endif
+
+#if TEST_STD_VER > 11
+ test<std::basic_string_view<char, constexpr_char_traits<char>>>();
+ static_assert(test<std::basic_string_view<char, constexpr_char_traits<char>>>(), "");
+#endif
+
+#if TEST_STD_VER > 17
+ test<std::u8string_view>();
+ static_assert(test<std::u8string_view>());
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/less.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/less.pass.cpp
new file mode 100644
index 0000000000000..5c9e052fad7f8
--- /dev/null
+++ b/libcxx/test/std/strings/string.view/string.view.comparison/less.pass.cpp
@@ -0,0 +1,116 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_view>
+
+// template<class charT, class traits>
+// constexpr bool operator<(basic_string_view<charT, traits> lhs, basic_string_view<charT, traits> rhs);
+// (plus "sufficient additional overloads" to make implicit conversions work as intended)
+
+#include <string_view>
+#include <cassert>
+#include <string>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.h"
+#include "make_string.h"
+
+template<class T>
+struct ConvertibleTo {
+ T t_;
+ TEST_CONSTEXPR explicit ConvertibleTo(T t) : t_(t) {}
+ TEST_CONSTEXPR operator T() const {
+ return t_;
+ }
+};
+
+template<class SV>
+TEST_CONSTEXPR_CXX14 bool test()
+{
+ typedef typename SV::value_type CharT;
+ typedef typename SV::traits_type Traits;
+
+ // Test the behavior of the operator, both with and without implicit conversions.
+ SV v[] = {
+ SV(MAKE_CSTRING(CharT, "")),
+ SV(MAKE_CSTRING(CharT, "abc")),
+ SV(MAKE_CSTRING(CharT, "abcdef")),
+ SV(MAKE_CSTRING(CharT, "acb")),
+ };
+ for (int i = 0; i < 4; ++i) {
+ for (int j = 0; j < 4; ++j) {
+ // See http://eel.is/c++draft/string.view#tab:string.view.comparison.overloads
+ bool expected = (i < j);
+ assert((v[i] < v[j]) == expected);
+ assert((v[i].data() < v[j]) == expected);
+ assert((v[i] < v[j].data()) == expected);
+ assert((ConvertibleTo<SV>(v[i]) < v[j]) == expected);
+ assert((v[i] < ConvertibleTo<SV>(v[j])) == expected);
+
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ // TODO FIXME: once P0980 "Making std::string constexpr" is implemented
+ assert((std::basic_string<CharT, Traits>(v[i]) < v[j]) == expected);
+ assert((v[i] < std::basic_string<CharT, Traits>(v[j])) == expected);
+ }
+ }
+ }
+
+ // Test its behavior with embedded null bytes.
+ SV abc = SV(MAKE_CSTRING(CharT, "abc"));
+ SV abc0def = SV(MAKE_CSTRING(CharT, "abc\0def"), 7);
+ SV abcdef = SV(MAKE_CSTRING(CharT, "abcdef"));
+ assert((abc < abc0def) == true);
+ assert((abc < abcdef) == true);
+ assert((abc0def < abc) == false);
+ assert((abc0def < abcdef) == true);
+ assert((abcdef < abc) == false);
+ assert((abcdef < abc0def) == false);
+
+ assert((abc.data() < abc0def) == true);
+ assert((abc0def < abc.data()) == false);
+
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ // TODO FIXME: once P0980 "Making std::string constexpr" is implemented
+ assert((std::basic_string<CharT, Traits>(abc) < abc0def) == true);
+ assert((abc0def < std::basic_string<CharT, Traits>(abc)) == false);
+ }
+
+ return true;
+}
+
+int main(int, char**)
+{
+ test<std::string_view>();
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
+ test<std::wstring_view>();
+#endif
+#if TEST_STD_VER >= 11
+ test<std::u16string_view>();
+ test<std::u32string_view>();
+#endif
+#if TEST_STD_VER > 14
+ static_assert(test<std::string_view>(), "");
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
+ static_assert(test<std::wstring_view>(), "");
+#endif
+ static_assert(test<std::u16string_view>(), "");
+ static_assert(test<std::u32string_view>(), "");
+#endif
+
+#if TEST_STD_VER > 11
+ test<std::basic_string_view<char, constexpr_char_traits<char>>>();
+ static_assert(test<std::basic_string_view<char, constexpr_char_traits<char>>>(), "");
+#endif
+
+#if TEST_STD_VER > 17
+ test<std::u8string_view>();
+ static_assert(test<std::u8string_view>());
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/less_equal.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/less_equal.pass.cpp
new file mode 100644
index 0000000000000..b7e31c6945ba6
--- /dev/null
+++ b/libcxx/test/std/strings/string.view/string.view.comparison/less_equal.pass.cpp
@@ -0,0 +1,116 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_view>
+
+// template<class charT, class traits>
+// constexpr bool operator<=(basic_string_view<charT, traits> lhs, basic_string_view<charT, traits> rhs);
+// (plus "sufficient additional overloads" to make implicit conversions work as intended)
+
+#include <string_view>
+#include <cassert>
+#include <string>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.h"
+#include "make_string.h"
+
+template<class T>
+struct ConvertibleTo {
+ T t_;
+ TEST_CONSTEXPR explicit ConvertibleTo(T t) : t_(t) {}
+ TEST_CONSTEXPR operator T() const {
+ return t_;
+ }
+};
+
+template<class SV>
+TEST_CONSTEXPR_CXX14 bool test()
+{
+ typedef typename SV::value_type CharT;
+ typedef typename SV::traits_type Traits;
+
+ // Test the behavior of the operator, both with and without implicit conversions.
+ SV v[] = {
+ SV(MAKE_CSTRING(CharT, "")),
+ SV(MAKE_CSTRING(CharT, "abc")),
+ SV(MAKE_CSTRING(CharT, "abcdef")),
+ SV(MAKE_CSTRING(CharT, "acb")),
+ };
+ for (int i = 0; i < 4; ++i) {
+ for (int j = 0; j < 4; ++j) {
+ // See http://eel.is/c++draft/string.view#tab:string.view.comparison.overloads
+ bool expected = (i <= j);
+ assert((v[i] <= v[j]) == expected);
+ assert((v[i].data() <= v[j]) == expected);
+ assert((v[i] <= v[j].data()) == expected);
+ assert((ConvertibleTo<SV>(v[i]) <= v[j]) == expected);
+ assert((v[i] <= ConvertibleTo<SV>(v[j])) == expected);
+
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ // TODO FIXME: once P0980 "Making std::string constexpr" is implemented
+ assert((std::basic_string<CharT, Traits>(v[i]) <= v[j]) == expected);
+ assert((v[i] <= std::basic_string<CharT, Traits>(v[j])) == expected);
+ }
+ }
+ }
+
+ // Test its behavior with embedded null bytes.
+ SV abc = SV(MAKE_CSTRING(CharT, "abc"));
+ SV abc0def = SV(MAKE_CSTRING(CharT, "abc\0def"), 7);
+ SV abcdef = SV(MAKE_CSTRING(CharT, "abcdef"));
+ assert((abc <= abc0def) == true);
+ assert((abc <= abcdef) == true);
+ assert((abc0def <= abc) == false);
+ assert((abc0def <= abcdef) == true);
+ assert((abcdef <= abc) == false);
+ assert((abcdef <= abc0def) == false);
+
+ assert((abc.data() <= abc0def) == true);
+ assert((abc0def <= abc.data()) == false);
+
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ // TODO FIXME: once P0980 "Making std::string constexpr" is implemented
+ assert((std::basic_string<CharT, Traits>(abc) <= abc0def) == true);
+ assert((abc0def <= std::basic_string<CharT, Traits>(abc)) == false);
+ }
+
+ return true;
+}
+
+int main(int, char**)
+{
+ test<std::string_view>();
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
+ test<std::wstring_view>();
+#endif
+#if TEST_STD_VER >= 11
+ test<std::u16string_view>();
+ test<std::u32string_view>();
+#endif
+#if TEST_STD_VER > 14
+ static_assert(test<std::string_view>(), "");
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
+ static_assert(test<std::wstring_view>(), "");
+#endif
+ static_assert(test<std::u16string_view>(), "");
+ static_assert(test<std::u32string_view>(), "");
+#endif
+
+#if TEST_STD_VER > 11
+ test<std::basic_string_view<char, constexpr_char_traits<char>>>();
+ static_assert(test<std::basic_string_view<char, constexpr_char_traits<char>>>(), "");
+#endif
+
+#if TEST_STD_VER > 17
+ test<std::u8string_view>();
+ static_assert(test<std::u8string_view>());
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/not_equal.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/not_equal.pass.cpp
new file mode 100644
index 0000000000000..bca79e48bb300
--- /dev/null
+++ b/libcxx/test/std/strings/string.view/string.view.comparison/not_equal.pass.cpp
@@ -0,0 +1,116 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_view>
+
+// template<class charT, class traits>
+// constexpr bool operator!=(basic_string_view<charT, traits> lhs, basic_string_view<charT, traits> rhs);
+// (plus "sufficient additional overloads" to make implicit conversions work as intended)
+
+#include <string_view>
+#include <cassert>
+#include <string>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.h"
+#include "make_string.h"
+
+template<class T>
+struct ConvertibleTo {
+ T t_;
+ TEST_CONSTEXPR explicit ConvertibleTo(T t) : t_(t) {}
+ TEST_CONSTEXPR operator T() const {
+ return t_;
+ }
+};
+
+template<class SV>
+TEST_CONSTEXPR_CXX14 bool test()
+{
+ typedef typename SV::value_type CharT;
+ typedef typename SV::traits_type Traits;
+
+ // Test the behavior of the operator, both with and without implicit conversions.
+ SV v[] = {
+ SV(MAKE_CSTRING(CharT, "")),
+ SV(MAKE_CSTRING(CharT, "abc")),
+ SV(MAKE_CSTRING(CharT, "abcdef")),
+ SV(MAKE_CSTRING(CharT, "acb")),
+ };
+ for (int i = 0; i < 4; ++i) {
+ for (int j = 0; j < 4; ++j) {
+ // See http://eel.is/c++draft/string.view#tab:string.view.comparison.overloads
+ bool expected = (i != j);
+ assert((v[i] != v[j]) == expected);
+ assert((v[i].data() != v[j]) == expected);
+ assert((v[i] != v[j].data()) == expected);
+ assert((ConvertibleTo<SV>(v[i]) != v[j]) == expected);
+ assert((v[i] != ConvertibleTo<SV>(v[j])) == expected);
+
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ // TODO FIXME: once P0980 "Making std::string constexpr" is implemented
+ assert((std::basic_string<CharT, Traits>(v[i]) != v[j]) == expected);
+ assert((v[i] != std::basic_string<CharT, Traits>(v[j])) == expected);
+ }
+ }
+ }
+
+ // Test its behavior with embedded null bytes.
+ SV abc = SV(MAKE_CSTRING(CharT, "abc"));
+ SV abc0def = SV(MAKE_CSTRING(CharT, "abc\0def"), 7);
+ SV abcdef = SV(MAKE_CSTRING(CharT, "abcdef"));
+ assert((abc != abc0def) == true);
+ assert((abc != abcdef) == true);
+ assert((abc0def != abc) == true);
+ assert((abc0def != abcdef) == true);
+ assert((abcdef != abc) == true);
+ assert((abcdef != abc0def) == true);
+
+ assert((abc.data() != abc0def) == true);
+ assert((abc0def != abc.data()) == true);
+
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ // TODO FIXME: once P0980 "Making std::string constexpr" is implemented
+ assert((std::basic_string<CharT, Traits>(abc) != abc0def) == true);
+ assert((abc0def != std::basic_string<CharT, Traits>(abc)) == true);
+ }
+
+ return true;
+}
+
+int main(int, char**)
+{
+ test<std::string_view>();
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
+ test<std::wstring_view>();
+#endif
+#if TEST_STD_VER >= 11
+ test<std::u16string_view>();
+ test<std::u32string_view>();
+#endif
+#if TEST_STD_VER > 14
+ static_assert(test<std::string_view>(), "");
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
+ static_assert(test<std::wstring_view>(), "");
+#endif
+ static_assert(test<std::u16string_view>(), "");
+ static_assert(test<std::u32string_view>(), "");
+#endif
+
+#if TEST_STD_VER > 11
+ test<std::basic_string_view<char, constexpr_char_traits<char>>>();
+ static_assert(test<std::basic_string_view<char, constexpr_char_traits<char>>>(), "");
+#endif
+
+#if TEST_STD_VER > 17
+ test<std::u8string_view>();
+ static_assert(test<std::u8string_view>());
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp
deleted file mode 100644
index 0a89e04035971..0000000000000
--- a/libcxx/test/std/strings/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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_view>
-
-// template<class charT, class traits>
-// constexpr bool operator==(basic_string_view<charT,traits> lhs, const charT* rhs);
-// template<class charT, class traits>
-// constexpr bool operator==(const charT* lhs, basic_string_view<charT,traits> rhs);
-
-#include <string_view>
-#include <cassert>
-
-#include "test_macros.h"
-#include "constexpr_char_traits.h"
-
-template <class S>
-void
-test(S lhs, const typename S::value_type* rhs, bool x)
-{
- assert((lhs == rhs) == x);
- assert((rhs == lhs) == x);
-}
-
-int main(int, char**)
-{
- {
- typedef std::string_view S;
- test(S(""), "", true);
- test(S(""), "abcde", false);
- test(S(""), "abcdefghij", false);
- test(S(""), "abcdefghijklmnopqrst", false);
- test(S("abcde"), "", false);
- test(S("abcde"), "abcde", true);
- test(S("abcde"), "abcdefghij", false);
- test(S("abcde"), "abcdefghijklmnopqrst", false);
- test(S("abcdefghij"), "", false);
- test(S("abcdefghij"), "abcde", false);
- test(S("abcdefghij"), "abcdefghij", true);
- test(S("abcdefghij"), "abcdefghijklmnopqrst", false);
- test(S("abcdefghijklmnopqrst"), "", false);
- test(S("abcdefghijklmnopqrst"), "abcde", false);
- test(S("abcdefghijklmnopqrst"), "abcdefghij", false);
- test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true);
- }
-
-#if TEST_STD_VER > 11
- {
- typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
- constexpr SV sv1;
- constexpr SV sv2 { "abcde", 5 };
- static_assert ( sv1 == "", "" );
- static_assert ( "" == sv1, "" );
- static_assert (!(sv1 == "abcde"), "" );
- static_assert (!("abcde" == sv1), "" );
-
- static_assert ( sv2 == "abcde", "" );
- static_assert ( "abcde" == sv2, "" );
- static_assert (!(sv2 == "abcde0"), "" );
- static_assert (!("abcde0" == sv2), "" );
- }
-#endif
-
- return 0;
-}
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/opeq.string_view.string.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/opeq.string_view.string.pass.cpp
deleted file mode 100644
index 2d01ecadfd8cc..0000000000000
--- a/libcxx/test/std/strings/string.view/string.view.comparison/opeq.string_view.string.pass.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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_view>
-
-// template<class charT, class traits, class Allocator>
-// bool operator==(const charT* lhs, const basic_string<charT,traits> rhs);
-// template<class charT, class traits, class Allocator>
-// bool operator==(const basic_string_view<charT,traits> lhs, const CharT* rhs);
-
-#include <string_view>
-#include <string>
-#include <cassert>
-
-#include "test_macros.h"
-
-template <class S>
-void
-test(const std::string &lhs, S rhs, bool x)
-{
- assert((lhs == rhs) == x);
- assert((rhs == lhs) == x);
-}
-
-int main(int, char**)
-{
- {
- typedef std::string_view S;
- test("", S(""), true);
- test("", S("abcde"), false);
- test("", S("abcdefghij"), false);
- test("", S("abcdefghijklmnopqrst"), false);
- test("abcde", S(""), false);
- test("abcde", S("abcde"), true);
- test("abcde", S("abcdefghij"), false);
- test("abcde", S("abcdefghijklmnopqrst"), false);
- test("abcdefghij", S(""), false);
- test("abcdefghij", S("abcde"), false);
- test("abcdefghij", S("abcdefghij"), true);
- test("abcdefghij", S("abcdefghijklmnopqrst"), false);
- test("abcdefghijklmnopqrst", S(""), false);
- test("abcdefghijklmnopqrst", S("abcde"), false);
- test("abcdefghijklmnopqrst", S("abcdefghij"), false);
- test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true);
- }
-
- return 0;
-}
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp
deleted file mode 100644
index 3a5eeb732dea6..0000000000000
--- a/libcxx/test/std/strings/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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_view>
-
-// template<class charT, class traits, class Allocator>
-// constexpr bool operator==(const basic_string_view<charT,traits> lhs,
-// const basic_string_view<charT,traits> rhs);
-
-#include <string_view>
-#include <cassert>
-
-#include "test_macros.h"
-#include "constexpr_char_traits.h"
-
-template <class S>
-void
-test(S lhs, S rhs, bool x)
-{
- assert((lhs == rhs) == x);
- assert((rhs == lhs) == x);
-}
-
-int main(int, char**)
-{
- {
- typedef std::string_view S;
- test(S(""), S(""), true);
- test(S(""), S("abcde"), false);
- test(S(""), S("abcdefghij"), false);
- test(S(""), S("abcdefghijklmnopqrst"), false);
- test(S("abcde"), S(""), false);
- test(S("abcde"), S("abcde"), true);
- test(S("abcde"), S("abcdefghij"), false);
- test(S("abcde"), S("abcdefghijklmnopqrst"), false);
- test(S("abcdefghij"), S(""), false);
- test(S("abcdefghij"), S("abcde"), false);
- test(S("abcdefghij"), S("abcdefghij"), true);
- test(S("abcdefghij"), S("abcdefghijklmnopqrst"), false);
- test(S("abcdefghijklmnopqrst"), S(""), false);
- test(S("abcdefghijklmnopqrst"), S("abcde"), false);
- test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false);
- test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true);
- }
-
-#if TEST_STD_VER > 11
- {
- typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
- constexpr SV sv1;
- constexpr SV sv2;
- constexpr SV sv3 { "abcde", 5 };
- static_assert ( sv1 == sv2, "" );
- static_assert (!(sv1 == sv3), "" );
- }
-#endif
-
- return 0;
-}
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp
deleted file mode 100644
index 685d2063c5a0a..0000000000000
--- a/libcxx/test/std/strings/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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_view>
-
-// template<class charT, class traits, class Allocator>
-// constexpr bool operator>=(const charT* lhs, basic_string_view<charT,traits> rhs);
-// template<class charT, class traits, class Allocator>
-// constexpr bool operator>=(basic_string_view<charT,traits> lhs, const charT* rhs);
-
-#include <string_view>
-#include <cassert>
-
-#include "test_macros.h"
-#include "constexpr_char_traits.h"
-
-template <class S>
-void
-test(const typename S::value_type* lhs, const S& rhs, bool x, bool y)
-{
- assert((lhs >= rhs) == x);
- assert((rhs >= lhs) == y);
-}
-
-int main(int, char**)
-{
- {
- typedef std::string_view S;
- test("", S(""), true, true);
- test("", S("abcde"), false, true);
- test("", S("abcdefghij"), false, true);
- test("", S("abcdefghijklmnopqrst"), false, true);
- test("abcde", S(""), true, false);
- test("abcde", S("abcde"), true, true);
- test("abcde", S("abcdefghij"), false, true);
- test("abcde", S("abcdefghijklmnopqrst"), false, true);
- test("abcdefghij", S(""), true, false);
- test("abcdefghij", S("abcde"), true, false);
- test("abcdefghij", S("abcdefghij"), true, true);
- test("abcdefghij", S("abcdefghijklmnopqrst"), false, true);
- test("abcdefghijklmnopqrst", S(""), true, false);
- test("abcdefghijklmnopqrst", S("abcde"), true, false);
- test("abcdefghijklmnopqrst", S("abcdefghij"), true, false);
- test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true, true);
- }
-
-#if TEST_STD_VER > 11
- {
- typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
- constexpr SV sv1;
- constexpr SV sv2 { "abcde", 5 };
-
- static_assert ( sv1 >= "", "" );
- static_assert ( "" >= sv1, "" );
- static_assert (!(sv1 >= "abcde"), "" );
- static_assert ( "abcde" >= sv1, "" );
-
- static_assert ( sv2 >= "", "" );
- static_assert (!("" >= sv2), "" );
- static_assert ( sv2 >= "abcde", "" );
- static_assert ( "abcde" >= sv2, "" );
- static_assert (!(sv2 >= "abcde0"), "" );
- static_assert ( "abcde0" >= sv2, "" );
- }
-#endif
-
- return 0;
-}
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/opge.string_view.string.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/opge.string_view.string.pass.cpp
deleted file mode 100644
index 03fd89951a807..0000000000000
--- a/libcxx/test/std/strings/string.view/string.view.comparison/opge.string_view.string.pass.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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_view>
-
-// template<class charT, class traits, class Allocator>
-// bool operator>=(const basic_string<charT,traits,Allocator>& lhs,
-// basic_string_view<charT,traits> rhs);
-// bool operator>=(basic_string_view<charT,traits> lhs,
-// const basic_string<charT,traits,Allocator>& rhs);
-
-#include <string_view>
-#include <cassert>
-
-#include "test_macros.h"
-
-template <class S>
-void
-test(const S& lhs, const typename S::value_type* rhs, bool x, bool y)
-{
- assert((lhs >= rhs) == x);
- assert((rhs >= lhs) == y);
-}
-
-int main(int, char**)
-{
- {
- typedef std::string_view S;
- test(S(""), "", true, true);
- test(S(""), "abcde", false, true);
- test(S(""), "abcdefghij", false, true);
- test(S(""), "abcdefghijklmnopqrst", false, true);
- test(S("abcde"), "", true, false);
- test(S("abcde"), "abcde", true, true);
- test(S("abcde"), "abcdefghij", false, true);
- test(S("abcde"), "abcdefghijklmnopqrst", false, true);
- test(S("abcdefghij"), "", true, false);
- test(S("abcdefghij"), "abcde", true, false);
- test(S("abcdefghij"), "abcdefghij", true, true);
- test(S("abcdefghij"), "abcdefghijklmnopqrst", false, true);
- test(S("abcdefghijklmnopqrst"), "", true, false);
- test(S("abcdefghijklmnopqrst"), "abcde", true, false);
- test(S("abcdefghijklmnopqrst"), "abcdefghij", true, false);
- test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true, true);
- }
-
- return 0;
-}
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp
deleted file mode 100644
index a24d001260393..0000000000000
--- a/libcxx/test/std/strings/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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_view>
-
-// template<class charT, class traits>
-// constexpr bool operator>=(basic_string_view<charT,traits> lhs,
-// basic_string_view<charT,traits> rhs);
-
-#include <string_view>
-#include <cassert>
-
-#include "test_macros.h"
-#include "constexpr_char_traits.h"
-
-template <class S>
-void
-test(const S& lhs, const S& rhs, bool x, bool y)
-{
- assert((lhs >= rhs) == x);
- assert((rhs >= lhs) == y);
-}
-
-int main(int, char**)
-{
- {
- typedef std::string_view S;
- test(S(""), S(""), true, true);
- test(S(""), S("abcde"), false, true);
- test(S(""), S("abcdefghij"), false, true);
- test(S(""), S("abcdefghijklmnopqrst"), false, true);
- test(S("abcde"), S(""), true, false);
- test(S("abcde"), S("abcde"), true, true);
- test(S("abcde"), S("abcdefghij"), false, true);
- test(S("abcde"), S("abcdefghijklmnopqrst"), false, true);
- test(S("abcdefghij"), S(""), true, false);
- test(S("abcdefghij"), S("abcde"), true, false);
- test(S("abcdefghij"), S("abcdefghij"), true, true);
- test(S("abcdefghij"), S("abcdefghijklmnopqrst"), false, true);
- test(S("abcdefghijklmnopqrst"), S(""), true, false);
- test(S("abcdefghijklmnopqrst"), S("abcde"), true, false);
- test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true, false);
- test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true, true);
- }
-
-#if TEST_STD_VER > 11
- {
- typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
- constexpr SV sv1;
- constexpr SV sv2 { "abcde", 5 };
-
- static_assert ( sv1 >= sv1, "" );
- static_assert ( sv2 >= sv2, "" );
-
- static_assert (!(sv1 >= sv2), "" );
- static_assert ( sv2 >= sv1, "" );
- }
-#endif
-
- return 0;
-}
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp
deleted file mode 100644
index 9f31974f73097..0000000000000
--- a/libcxx/test/std/strings/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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_view>
-
-// constexpr template<class charT, class traits, class Allocator>
-// bool operator>(const charT* lhs, basic_string_view<charT,traits> rhs);
-// constexpr template<class charT, class traits, class Allocator>
-// bool operator>(basic_string_view<charT,traits> lhs, const charT* rhs);
-
-#include <string_view>
-#include <cassert>
-
-#include "test_macros.h"
-#include "constexpr_char_traits.h"
-
-template <class S>
-void
-test(const typename S::value_type* lhs, const S& rhs, bool x, bool y)
-{
- assert((lhs > rhs) == x);
- assert((rhs > lhs) == y);
-}
-
-int main(int, char**)
-{
- {
- typedef std::string_view S;
- test("", S(""), false, false);
- test("", S("abcde"), false, true);
- test("", S("abcdefghij"), false, true);
- test("", S("abcdefghijklmnopqrst"), false, true);
- test("abcde", S(""), true, false);
- test("abcde", S("abcde"), false, false);
- test("abcde", S("abcdefghij"), false, true);
- test("abcde", S("abcdefghijklmnopqrst"), false, true);
- test("abcdefghij", S(""), true, false);
- test("abcdefghij", S("abcde"), true, false);
- test("abcdefghij", S("abcdefghij"), false, false);
- test("abcdefghij", S("abcdefghijklmnopqrst"), false, true);
- test("abcdefghijklmnopqrst", S(""), true, false);
- test("abcdefghijklmnopqrst", S("abcde"), true, false);
- test("abcdefghijklmnopqrst", S("abcdefghij"), true, false);
- test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false, false);
- }
-
-#if TEST_STD_VER > 11
- {
- typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
- constexpr SV sv1;
- constexpr SV sv2 { "abcde", 5 };
-
- static_assert (!(sv1 > ""), "" );
- static_assert (!("" > sv1), "" );
- static_assert (!(sv1 > "abcde"), "" );
- static_assert ( "abcde" > sv1, "" );
-
- static_assert ( sv2 > "", "" );
- static_assert (!("" > sv2), "" );
- static_assert (!(sv2 > "abcde"), "" );
- static_assert (!("abcde" > sv2), "" );
- static_assert (!(sv2 > "abcde0"), "" );
- static_assert ( "abcde0" > sv2, "" );
- }
-#endif
-
- return 0;
-}
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/opgt.string_view.string.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/opgt.string_view.string.pass.cpp
deleted file mode 100644
index f0350dfe7ecd0..0000000000000
--- a/libcxx/test/std/strings/string.view/string.view.comparison/opgt.string_view.string.pass.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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_view>
-
-// template<class charT, class traits, class Allocator>
-// bool operator>(const basic_string<charT,traits,Allocator>& lhs,
-// basic_string_view<charT,traits> rhs);
-// bool operator>(basic_string_view<charT,traits> lhs,
-// const basic_string<charT,traits,Allocator>& rhs);
-
-#include <string_view>
-#include <cassert>
-
-#include "test_macros.h"
-
-template <class S>
-void
-test(const S& lhs, const typename S::value_type* rhs, bool x, bool y)
-{
- assert((lhs > rhs) == x);
- assert((rhs > lhs) == y);
-}
-
-int main(int, char**)
-{
- {
- typedef std::string_view S;
- test(S(""), "", false, false);
- test(S(""), "abcde", false, true);
- test(S(""), "abcdefghij", false, true);
- test(S(""), "abcdefghijklmnopqrst", false, true);
- test(S("abcde"), "", true, false);
- test(S("abcde"), "abcde", false, false);
- test(S("abcde"), "abcdefghij", false, true);
- test(S("abcde"), "abcdefghijklmnopqrst", false, true);
- test(S("abcdefghij"), "", true, false);
- test(S("abcdefghij"), "abcde", true, false);
- test(S("abcdefghij"), "abcdefghij", false, false);
- test(S("abcdefghij"), "abcdefghijklmnopqrst", false, true);
- test(S("abcdefghijklmnopqrst"), "", true, false);
- test(S("abcdefghijklmnopqrst"), "abcde", true, false);
- test(S("abcdefghijklmnopqrst"), "abcdefghij", true, false);
- test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false, false);
- }
-
- return 0;
-}
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp
deleted file mode 100644
index 62d3c25ac6243..0000000000000
--- a/libcxx/test/std/strings/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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_view>
-
-// template<class charT, class traits>
-// constexpr bool operator>(basic_string_view<charT,traits> lhs,
-// basic_string_view<charT,traits> rhs);
-
-#include <string_view>
-#include <cassert>
-
-#include "test_macros.h"
-#include "constexpr_char_traits.h"
-
-template <class S>
-void
-test(const S& lhs, const S& rhs, bool x, bool y)
-{
- assert((lhs > rhs) == x);
- assert((rhs > lhs) == y);
-}
-
-int main(int, char**)
-{
- {
- typedef std::string_view S;
- test(S(""), S(""), false, false);
- test(S(""), S("abcde"), false, true);
- test(S(""), S("abcdefghij"), false, true);
- test(S(""), S("abcdefghijklmnopqrst"), false, true);
- test(S("abcde"), S(""), true, false);
- test(S("abcde"), S("abcde"), false, false);
- test(S("abcde"), S("abcdefghij"), false, true);
- test(S("abcde"), S("abcdefghijklmnopqrst"), false, true);
- test(S("abcdefghij"), S(""), true, false);
- test(S("abcdefghij"), S("abcde"), true, false);
- test(S("abcdefghij"), S("abcdefghij"), false, false);
- test(S("abcdefghij"), S("abcdefghijklmnopqrst"), false, true);
- test(S("abcdefghijklmnopqrst"), S(""), true, false);
- test(S("abcdefghijklmnopqrst"), S("abcde"), true, false);
- test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true, false);
- test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false, false);
- }
-
-#if TEST_STD_VER > 11
- {
- typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
- constexpr SV sv1;
- constexpr SV sv2 { "abcde", 5 };
-
- static_assert (!(sv1 > sv1), "" );
- static_assert (!(sv2 > sv2), "" );
-
- static_assert (!(sv1 > sv2), "" );
- static_assert ( sv2 > sv1, "" );
- }
-#endif
-
- return 0;
-}
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp
deleted file mode 100644
index faea9f33585f2..0000000000000
--- a/libcxx/test/std/strings/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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_view>
-
-// template<class charT, class traits, class Allocator>
-// constexpr bool operator<=(const charT* lhs, basic_string_view<charT,traits> rhs);
-// template<class charT, class traits, class Allocator>
-// constexpr bool operator<=(basic_string_view<charT,traits> lhs, const charT* rhs);
-
-#include <string_view>
-#include <cassert>
-
-#include "test_macros.h"
-#include "constexpr_char_traits.h"
-
-template <class S>
-void
-test(const typename S::value_type* lhs, const S& rhs, bool x, bool y)
-{
- assert((lhs <= rhs) == x);
- assert((rhs <= lhs) == y);
-}
-
-int main(int, char**)
-{
- {
- typedef std::string_view S;
- test("", S(""), true, true);
- test("", S("abcde"), true, false);
- test("", S("abcdefghij"), true, false);
- test("", S("abcdefghijklmnopqrst"), true, false);
- test("abcde", S(""), false, true);
- test("abcde", S("abcde"), true, true);
- test("abcde", S("abcdefghij"), true, false);
- test("abcde", S("abcdefghijklmnopqrst"), true, false);
- test("abcdefghij", S(""), false, true);
- test("abcdefghij", S("abcde"), false, true);
- test("abcdefghij", S("abcdefghij"), true, true);
- test("abcdefghij", S("abcdefghijklmnopqrst"), true, false);
- test("abcdefghijklmnopqrst", S(""), false, true);
- test("abcdefghijklmnopqrst", S("abcde"), false, true);
- test("abcdefghijklmnopqrst", S("abcdefghij"), false, true);
- test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true, true);
- }
-
-#if TEST_STD_VER > 11
- {
- typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
- constexpr SV sv1;
- constexpr SV sv2 { "abcde", 5 };
-
- static_assert ( sv1 <= "", "" );
- static_assert ( "" <= sv1, "" );
- static_assert ( sv1 <= "abcde", "" );
- static_assert (!("abcde" <= sv1), "" );
-
- static_assert (!(sv2 <= ""), "" );
- static_assert ( "" <= sv2, "" );
- static_assert ( sv2 <= "abcde", "" );
- static_assert ( "abcde" <= sv2, "" );
- static_assert ( sv2 <= "abcde0", "" );
- static_assert (!("abcde0" <= sv2), "" );
- }
-#endif
-
- return 0;
-}
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/ople.string_view.string.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/ople.string_view.string.pass.cpp
deleted file mode 100644
index 2d9480b2de42e..0000000000000
--- a/libcxx/test/std/strings/string.view/string.view.comparison/ople.string_view.string.pass.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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_view>
-
-// template<class charT, class traits, class Allocator>
-// bool operator<=(const basic_string<charT,traits,Allocator>& lhs,
-// basic_string_view<charT,traits> rhs);
-// bool operator<=(basic_string_view<charT,traits> lhs,
-// const basic_string<charT,traits,Allocator>& rhs);
-
-#include <string_view>
-#include <cassert>
-
-#include "test_macros.h"
-
-template <class S>
-void
-test(const S& lhs, const typename S::value_type* rhs, bool x, bool y)
-{
- assert((lhs <= rhs) == x);
- assert((rhs <= lhs) == y);
-}
-
-int main(int, char**)
-{
- {
- typedef std::string_view S;
- test(S(""), "", true, true);
- test(S(""), "abcde", true, false);
- test(S(""), "abcdefghij", true, false);
- test(S(""), "abcdefghijklmnopqrst", true, false);
- test(S("abcde"), "", false, true);
- test(S("abcde"), "abcde", true, true);
- test(S("abcde"), "abcdefghij", true, false);
- test(S("abcde"), "abcdefghijklmnopqrst", true, false);
- test(S("abcdefghij"), "", false, true);
- test(S("abcdefghij"), "abcde", false, true);
- test(S("abcdefghij"), "abcdefghij", true, true);
- test(S("abcdefghij"), "abcdefghijklmnopqrst", true, false);
- test(S("abcdefghijklmnopqrst"), "", false, true);
- test(S("abcdefghijklmnopqrst"), "abcde", false, true);
- test(S("abcdefghijklmnopqrst"), "abcdefghij", false, true);
- test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true, true);
- }
-
- return 0;
-}
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp
deleted file mode 100644
index f4ec057bb8eda..0000000000000
--- a/libcxx/test/std/strings/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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_view>
-
-// template<class charT, class traits>
-// constexpr bool operator<=(basic_string_view<charT,traits> lhs,
-// basic_string_view<charT,traits> rhs);
-
-#include <string_view>
-#include <cassert>
-
-#include "test_macros.h"
-#include "constexpr_char_traits.h"
-
-template <class S>
-void
-test(const S& lhs, const S& rhs, bool x, bool y)
-{
- assert((lhs <= rhs) == x);
- assert((rhs <= lhs) == y);
-}
-
-int main(int, char**)
-{
- {
- typedef std::string_view S;
- test(S(""), S(""), true, true);
- test(S(""), S("abcde"), true, false);
- test(S(""), S("abcdefghij"), true, false);
- test(S(""), S("abcdefghijklmnopqrst"), true, false);
- test(S("abcde"), S(""), false, true);
- test(S("abcde"), S("abcde"), true, true);
- test(S("abcde"), S("abcdefghij"), true, false);
- test(S("abcde"), S("abcdefghijklmnopqrst"), true, false);
- test(S("abcdefghij"), S(""), false, true);
- test(S("abcdefghij"), S("abcde"), false, true);
- test(S("abcdefghij"), S("abcdefghij"), true, true);
- test(S("abcdefghij"), S("abcdefghijklmnopqrst"), true, false);
- test(S("abcdefghijklmnopqrst"), S(""), false, true);
- test(S("abcdefghijklmnopqrst"), S("abcde"), false, true);
- test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false, true);
- test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true, true);
- }
-
-#if TEST_STD_VER > 11
- {
- typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
- constexpr SV sv1;
- constexpr SV sv2 { "abcde", 5 };
-
- static_assert ( sv1 <= sv1, "" );
- static_assert ( sv2 <= sv2, "" );
-
- static_assert ( sv1 <= sv2, "" );
- static_assert (!(sv2 <= sv1), "" );
- }
-#endif
-
- return 0;
-}
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp
deleted file mode 100644
index b545b251d8e7d..0000000000000
--- a/libcxx/test/std/strings/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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_view>
-
-// template<class charT, class traits, class Allocator>
-// constexpr bool operator<(const charT* lhs, basic_string_view<charT,traits> rhs);
-// template<class charT, class traits, class Allocator>
-// constexpr bool operator<(basic_string_view<charT,traits> lhs, const charT* rhs);
-
-#include <string_view>
-#include <cassert>
-
-#include "test_macros.h"
-#include "constexpr_char_traits.h"
-
-template <class S>
-void
-test(const typename S::value_type* lhs, const S& rhs, bool x, bool y)
-{
- assert((lhs < rhs) == x);
- assert((rhs < lhs) == y);
-}
-
-int main(int, char**)
-{
- {
- typedef std::string_view S;
- test("", S(""), false, false);
- test("", S("abcde"), true, false);
- test("", S("abcdefghij"), true, false);
- test("", S("abcdefghijklmnopqrst"), true, false);
- test("abcde", S(""), false, true);
- test("abcde", S("abcde"), false, false);
- test("abcde", S("abcdefghij"), true, false);
- test("abcde", S("abcdefghijklmnopqrst"), true, false);
- test("abcdefghij", S(""), false, true);
- test("abcdefghij", S("abcde"), false, true);
- test("abcdefghij", S("abcdefghij"), false, false);
- test("abcdefghij", S("abcdefghijklmnopqrst"), true, false);
- test("abcdefghijklmnopqrst", S(""), false, true);
- test("abcdefghijklmnopqrst", S("abcde"), false, true);
- test("abcdefghijklmnopqrst", S("abcdefghij"), false, true);
- test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false, false);
- }
-
-#if TEST_STD_VER > 11
- {
- typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
- constexpr SV sv1;
- constexpr SV sv2 { "abcde", 5 };
-
- static_assert (!(sv1 < ""), "" );
- static_assert (!("" < sv1), "" );
- static_assert ( sv1 < "abcde", "" );
- static_assert (!("abcde" < sv1), "" );
-
- static_assert (!(sv2 < ""), "" );
- static_assert ( "" < sv2, "" );
- static_assert (!(sv2 < "abcde"), "" );
- static_assert (!("abcde" < sv2), "" );
- static_assert ( sv2 < "abcde0", "" );
- static_assert (!("abcde0" < sv2), "" );
- }
-#endif
-
- return 0;
-}
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/oplt.string_view.string.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/oplt.string_view.string.pass.cpp
deleted file mode 100644
index 03588b7caeec2..0000000000000
--- a/libcxx/test/std/strings/string.view/string.view.comparison/oplt.string_view.string.pass.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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_view>
-
-// template<class charT, class traits, class Allocator>
-// bool operator<(const basic_string<charT,traits,Allocator>& lhs,
-// basic_string_view<charT,traits> rhs);
-// bool operator<(basic_string_view<charT,traits> lhs,
-// const basic_string<charT,traits,Allocator>& rhs);
-
-#include <string_view>
-#include <cassert>
-
-#include "test_macros.h"
-
-template <class S>
-void
-test(const S& lhs, const typename S::value_type* rhs, bool x, bool y)
-{
- assert((lhs < rhs) == x);
- assert((rhs < lhs) == y);
-}
-
-int main(int, char**)
-{
- {
- typedef std::string_view S;
- test(S(""), "", false, false);
- test(S(""), "abcde", true, false);
- test(S(""), "abcdefghij", true, false);
- test(S(""), "abcdefghijklmnopqrst", true, false);
- test(S("abcde"), "", false, true);
- test(S("abcde"), "abcde", false, false);
- test(S("abcde"), "abcdefghij", true, false);
- test(S("abcde"), "abcdefghijklmnopqrst", true, false);
- test(S("abcdefghij"), "", false, true);
- test(S("abcdefghij"), "abcde", false, true);
- test(S("abcdefghij"), "abcdefghij", false, false);
- test(S("abcdefghij"), "abcdefghijklmnopqrst", true, false);
- test(S("abcdefghijklmnopqrst"), "", false, true);
- test(S("abcdefghijklmnopqrst"), "abcde", false, true);
- test(S("abcdefghijklmnopqrst"), "abcdefghij", false, true);
- test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false, false);
- }
-
- return 0;
-}
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp
deleted file mode 100644
index 6263a9c008bcd..0000000000000
--- a/libcxx/test/std/strings/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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_view>
-
-// template<class charT, class traits>
-// constexpr bool operator<(basic_string_view<charT,traits> lhs,
-// basic_string_view<charT,traits> rhs);
-
-#include <string_view>
-#include <cassert>
-
-#include "test_macros.h"
-#include "constexpr_char_traits.h"
-
-template <class S>
-void
-test(const S& lhs, const S& rhs, bool x, bool y)
-{
- assert((lhs < rhs) == x);
- assert((rhs < lhs) == y);
-}
-
-int main(int, char**)
-{
- {
- typedef std::string_view S;
- test(S(""), S(""), false, false);
- test(S(""), S("abcde"), true, false);
- test(S(""), S("abcdefghij"), true, false);
- test(S(""), S("abcdefghijklmnopqrst"), true, false);
- test(S("abcde"), S(""), false, true);
- test(S("abcde"), S("abcde"), false, false);
- test(S("abcde"), S("abcdefghij"), true, false);
- test(S("abcde"), S("abcdefghijklmnopqrst"), true, false);
- test(S("abcdefghij"), S(""), false, true);
- test(S("abcdefghij"), S("abcde"), false, true);
- test(S("abcdefghij"), S("abcdefghij"), false, false);
- test(S("abcdefghij"), S("abcdefghijklmnopqrst"), true, false);
- test(S("abcdefghijklmnopqrst"), S(""), false, true);
- test(S("abcdefghijklmnopqrst"), S("abcde"), false, true);
- test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false, true);
- test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false, false);
- }
-
-#if TEST_STD_VER > 11
- {
- typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
- constexpr SV sv1;
- constexpr SV sv2 { "abcde", 5 };
-
- static_assert (!(sv1 < sv1), "" );
- static_assert (!(sv2 < sv2), "" );
-
- static_assert ( sv1 < sv2, "" );
- static_assert (!(sv2 < sv1), "" );
- }
-#endif
-
- return 0;
-}
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp
deleted file mode 100644
index 2bd60af587fd9..0000000000000
--- a/libcxx/test/std/strings/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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_view>
-
-// template<class charT, class traits>
-// constexpr bool operator!=(basic_string_view<charT,traits> lhs, const charT* rhs);
-// template<class charT, class traits>
-// constexpr bool operator!=(const charT* lhs, basic_string_view<charT,traits> rhs);
-
-#include <string_view>
-#include <cassert>
-
-#include "test_macros.h"
-#include "constexpr_char_traits.h"
-
-template <class S>
-void
-test(S lhs, const typename S::value_type* rhs, bool x)
-{
- assert((lhs != rhs) == x);
- assert((rhs != lhs) == x);
-}
-
-int main(int, char**)
-{
- {
- typedef std::string_view S;
- test(S(""), "", false);
- test(S(""), "abcde", true);
- test(S(""), "abcdefghij", true);
- test(S(""), "abcdefghijklmnopqrst", true);
- test(S("abcde"), "", true);
- test(S("abcde"), "abcde", false);
- test(S("abcde"), "abcdefghij", true);
- test(S("abcde"), "abcdefghijklmnopqrst", true);
- test(S("abcdefghij"), "", true);
- test(S("abcdefghij"), "abcde", true);
- test(S("abcdefghij"), "abcdefghij", false);
- test(S("abcdefghij"), "abcdefghijklmnopqrst", true);
- test(S("abcdefghijklmnopqrst"), "", true);
- test(S("abcdefghijklmnopqrst"), "abcde", true);
- test(S("abcdefghijklmnopqrst"), "abcdefghij", true);
- test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false);
- }
-
-#if TEST_STD_VER > 11
- {
- typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
- constexpr SV sv1;
- constexpr SV sv2 { "abcde", 5 };
-
- static_assert (!(sv1 != ""), "" );
- static_assert (!("" != sv1), "" );
- static_assert ( sv1 != "abcde", "" );
- static_assert ( "abcde" != sv1, "" );
-
- static_assert (!(sv2 != "abcde"), "" );
- static_assert (!("abcde" != sv2), "" );
- static_assert ( sv2 != "abcde0", "" );
- static_assert ( "abcde0" != sv2, "" );
- }
-#endif
-
- return 0;
-}
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/opne.string_view.string.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/opne.string_view.string.pass.cpp
deleted file mode 100644
index 61923b60da9ae..0000000000000
--- a/libcxx/test/std/strings/string.view/string.view.comparison/opne.string_view.string.pass.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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_view>
-
-// template<class charT, class traits, class Allocator>
-// bool operator!=(const basic_string<charT, traits, Allocator> &lhs, basic_string_view<charT,traits> rhs);
-// template<class charT, class traits, class Allocator>
-// bool operator!=(basic_string_view<charT,traits> lhs, const basic_string<charT, traits, Allocator> &rhs);
-
-#include <string_view>
-#include <string>
-#include <cassert>
-
-#include "test_macros.h"
-
-template <class S>
-void
-test(const std::string &lhs, S rhs, bool x)
-{
- assert((lhs != rhs) == x);
- assert((rhs != lhs) == x);
-}
-
-int main(int, char**)
-{
- {
- typedef std::string_view S;
- test("", S(""), false);
- test("", S("abcde"), true);
- test("", S("abcdefghij"), true);
- test("", S("abcdefghijklmnopqrst"), true);
- test("abcde", S(""), true);
- test("abcde", S("abcde"), false);
- test("abcde", S("abcdefghij"), true);
- test("abcde", S("abcdefghijklmnopqrst"), true);
- test("abcdefghij", S(""), true);
- test("abcdefghij", S("abcde"), true);
- test("abcdefghij", S("abcdefghij"), false);
- test("abcdefghij", S("abcdefghijklmnopqrst"), true);
- test("abcdefghijklmnopqrst", S(""), true);
- test("abcdefghijklmnopqrst", S("abcde"), true);
- test("abcdefghijklmnopqrst", S("abcdefghij"), true);
- test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false);
- }
-
- return 0;
-}
diff --git a/libcxx/test/std/strings/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp b/libcxx/test/std/strings/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp
deleted file mode 100644
index fac4c0db57492..0000000000000
--- a/libcxx/test/std/strings/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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_view>
-
-// template<class charT, class traits, class Allocator>
-// constexpr bool operator!=(const basic_string_view<charT,traits> lhs,
-// const basic_string_view<charT,traits> rhs);
-
-#include <string_view>
-#include <cassert>
-
-#include "test_macros.h"
-#include "constexpr_char_traits.h"
-
-template <class S>
-void
-test(S lhs, S rhs, bool x)
-{
- assert((lhs != rhs) == x);
- assert((rhs != lhs) == x);
-}
-
-int main(int, char**)
-{
- {
- typedef std::string_view S;
- test(S(""), S(""), false);
- test(S(""), S("abcde"), true);
- test(S(""), S("abcdefghij"), true);
- test(S(""), S("abcdefghijklmnopqrst"), true);
- test(S("abcde"), S(""), true);
- test(S("abcde"), S("abcde"), false);
- test(S("abcde"), S("abcdefghij"), true);
- test(S("abcde"), S("abcdefghijklmnopqrst"), true);
- test(S("abcdefghij"), S(""), true);
- test(S("abcdefghij"), S("abcde"), true);
- test(S("abcdefghij"), S("abcdefghij"), false);
- test(S("abcdefghij"), S("abcdefghijklmnopqrst"), true);
- test(S("abcdefghijklmnopqrst"), S(""), true);
- test(S("abcdefghijklmnopqrst"), S("abcde"), true);
- test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true);
- test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false);
- }
-
-#if TEST_STD_VER > 11
- {
- typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
- constexpr SV sv1;
- constexpr SV sv2;
- constexpr SV sv3 { "abcde", 5 };
- static_assert (!( sv1 != sv2), "" );
- static_assert ( sv1 != sv3, "" );
- }
-#endif
-
- return 0;
-}
More information about the libcxx-commits
mailing list