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 --- /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 +// +//===----------------------------------------------------------------------===// + +// + +// template +// constexpr bool operator==(basic_string_view lhs, basic_string_view rhs); +// (plus "sufficient additional overloads" to make implicit conversions work as intended) + +#include +#include +#include + +#include "test_macros.h" +#include "constexpr_char_traits.h" +#include "make_string.h" + +template +struct ConvertibleTo { + T t_; + TEST_CONSTEXPR explicit ConvertibleTo(T t) : t_(t) {} + TEST_CONSTEXPR operator T() const { + return t_; + } +}; + +template +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(v[i]) == v[j]) == expected); + assert((v[i] == ConvertibleTo(v[j])) == expected); + + if (!TEST_IS_CONSTANT_EVALUATED) { + // TODO FIXME: once P0980 "Making std::string constexpr" is implemented + assert((std::basic_string(v[i]) == v[j]) == expected); + assert((v[i] == std::basic_string(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(abc) == abc0def) == false); + assert((abc0def == std::basic_string(abc)) == false); + } + + return true; +} + +int main(int, char**) +{ + test(); +#ifndef TEST_HAS_NO_WIDE_CHARACTERS + test(); +#endif +#if TEST_STD_VER >= 11 + test(); + test(); +#endif +#if TEST_STD_VER > 14 + static_assert(test(), ""); +#ifndef TEST_HAS_NO_WIDE_CHARACTERS + static_assert(test(), ""); +#endif + static_assert(test(), ""); + static_assert(test(), ""); +#endif + +#if TEST_STD_VER > 11 + test>>(); + static_assert(test>>(), ""); +#endif + +#if TEST_STD_VER > 17 + test(); + static_assert(test()); +#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 --- /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 +// +//===----------------------------------------------------------------------===// + +// + +// template +// constexpr bool operator>(basic_string_view lhs, basic_string_view rhs); +// (plus "sufficient additional overloads" to make implicit conversions work as intended) + +#include +#include +#include + +#include "test_macros.h" +#include "constexpr_char_traits.h" +#include "make_string.h" + +template +struct ConvertibleTo { + T t_; + TEST_CONSTEXPR explicit ConvertibleTo(T t) : t_(t) {} + TEST_CONSTEXPR operator T() const { + return t_; + } +}; + +template +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(v[i]) > v[j]) == expected); + assert((v[i] > ConvertibleTo(v[j])) == expected); + + if (!TEST_IS_CONSTANT_EVALUATED) { + // TODO FIXME: once P0980 "Making std::string constexpr" is implemented + assert((std::basic_string(v[i]) > v[j]) == expected); + assert((v[i] > std::basic_string(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(abc) > abc0def) == false); + assert((abc0def > std::basic_string(abc)) == true); + } + + return true; +} + +int main(int, char**) +{ + test(); +#ifndef TEST_HAS_NO_WIDE_CHARACTERS + test(); +#endif +#if TEST_STD_VER >= 11 + test(); + test(); +#endif +#if TEST_STD_VER > 14 + static_assert(test(), ""); +#ifndef TEST_HAS_NO_WIDE_CHARACTERS + static_assert(test(), ""); +#endif + static_assert(test(), ""); + static_assert(test(), ""); +#endif + +#if TEST_STD_VER > 11 + test>>(); + static_assert(test>>(), ""); +#endif + +#if TEST_STD_VER > 17 + test(); + static_assert(test()); +#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 --- /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 +// +//===----------------------------------------------------------------------===// + +// + +// template +// constexpr bool operator>=(basic_string_view lhs, basic_string_view rhs); +// (plus "sufficient additional overloads" to make implicit conversions work as intended) + +#include +#include +#include + +#include "test_macros.h" +#include "constexpr_char_traits.h" +#include "make_string.h" + +template +struct ConvertibleTo { + T t_; + TEST_CONSTEXPR explicit ConvertibleTo(T t) : t_(t) {} + TEST_CONSTEXPR operator T() const { + return t_; + } +}; + +template +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(v[i]) >= v[j]) == expected); + assert((v[i] >= ConvertibleTo(v[j])) == expected); + + if (!TEST_IS_CONSTANT_EVALUATED) { + // TODO FIXME: once P0980 "Making std::string constexpr" is implemented + assert((std::basic_string(v[i]) >= v[j]) == expected); + assert((v[i] >= std::basic_string(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(abc) >= abc0def) == false); + assert((abc0def >= std::basic_string(abc)) == true); + } + + return true; +} + +int main(int, char**) +{ + test(); +#ifndef TEST_HAS_NO_WIDE_CHARACTERS + test(); +#endif +#if TEST_STD_VER >= 11 + test(); + test(); +#endif +#if TEST_STD_VER > 14 + static_assert(test(), ""); +#ifndef TEST_HAS_NO_WIDE_CHARACTERS + static_assert(test(), ""); +#endif + static_assert(test(), ""); + static_assert(test(), ""); +#endif + +#if TEST_STD_VER > 11 + test>>(); + static_assert(test>>(), ""); +#endif + +#if TEST_STD_VER > 17 + test(); + static_assert(test()); +#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 --- /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 +// +//===----------------------------------------------------------------------===// + +// + +// template +// constexpr bool operator<(basic_string_view lhs, basic_string_view rhs); +// (plus "sufficient additional overloads" to make implicit conversions work as intended) + +#include +#include +#include + +#include "test_macros.h" +#include "constexpr_char_traits.h" +#include "make_string.h" + +template +struct ConvertibleTo { + T t_; + TEST_CONSTEXPR explicit ConvertibleTo(T t) : t_(t) {} + TEST_CONSTEXPR operator T() const { + return t_; + } +}; + +template +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(v[i]) < v[j]) == expected); + assert((v[i] < ConvertibleTo(v[j])) == expected); + + if (!TEST_IS_CONSTANT_EVALUATED) { + // TODO FIXME: once P0980 "Making std::string constexpr" is implemented + assert((std::basic_string(v[i]) < v[j]) == expected); + assert((v[i] < std::basic_string(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(abc) < abc0def) == true); + assert((abc0def < std::basic_string(abc)) == false); + } + + return true; +} + +int main(int, char**) +{ + test(); +#ifndef TEST_HAS_NO_WIDE_CHARACTERS + test(); +#endif +#if TEST_STD_VER >= 11 + test(); + test(); +#endif +#if TEST_STD_VER > 14 + static_assert(test(), ""); +#ifndef TEST_HAS_NO_WIDE_CHARACTERS + static_assert(test(), ""); +#endif + static_assert(test(), ""); + static_assert(test(), ""); +#endif + +#if TEST_STD_VER > 11 + test>>(); + static_assert(test>>(), ""); +#endif + +#if TEST_STD_VER > 17 + test(); + static_assert(test()); +#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 --- /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 +// +//===----------------------------------------------------------------------===// + +// + +// template +// constexpr bool operator<=(basic_string_view lhs, basic_string_view rhs); +// (plus "sufficient additional overloads" to make implicit conversions work as intended) + +#include +#include +#include + +#include "test_macros.h" +#include "constexpr_char_traits.h" +#include "make_string.h" + +template +struct ConvertibleTo { + T t_; + TEST_CONSTEXPR explicit ConvertibleTo(T t) : t_(t) {} + TEST_CONSTEXPR operator T() const { + return t_; + } +}; + +template +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(v[i]) <= v[j]) == expected); + assert((v[i] <= ConvertibleTo(v[j])) == expected); + + if (!TEST_IS_CONSTANT_EVALUATED) { + // TODO FIXME: once P0980 "Making std::string constexpr" is implemented + assert((std::basic_string(v[i]) <= v[j]) == expected); + assert((v[i] <= std::basic_string(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(abc) <= abc0def) == true); + assert((abc0def <= std::basic_string(abc)) == false); + } + + return true; +} + +int main(int, char**) +{ + test(); +#ifndef TEST_HAS_NO_WIDE_CHARACTERS + test(); +#endif +#if TEST_STD_VER >= 11 + test(); + test(); +#endif +#if TEST_STD_VER > 14 + static_assert(test(), ""); +#ifndef TEST_HAS_NO_WIDE_CHARACTERS + static_assert(test(), ""); +#endif + static_assert(test(), ""); + static_assert(test(), ""); +#endif + +#if TEST_STD_VER > 11 + test>>(); + static_assert(test>>(), ""); +#endif + +#if TEST_STD_VER > 17 + test(); + static_assert(test()); +#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 --- /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 +// +//===----------------------------------------------------------------------===// + +// + +// template +// constexpr bool operator!=(basic_string_view lhs, basic_string_view rhs); +// (plus "sufficient additional overloads" to make implicit conversions work as intended) + +#include +#include +#include + +#include "test_macros.h" +#include "constexpr_char_traits.h" +#include "make_string.h" + +template +struct ConvertibleTo { + T t_; + TEST_CONSTEXPR explicit ConvertibleTo(T t) : t_(t) {} + TEST_CONSTEXPR operator T() const { + return t_; + } +}; + +template +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(v[i]) != v[j]) == expected); + assert((v[i] != ConvertibleTo(v[j])) == expected); + + if (!TEST_IS_CONSTANT_EVALUATED) { + // TODO FIXME: once P0980 "Making std::string constexpr" is implemented + assert((std::basic_string(v[i]) != v[j]) == expected); + assert((v[i] != std::basic_string(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(abc) != abc0def) == true); + assert((abc0def != std::basic_string(abc)) == true); + } + + return true; +} + +int main(int, char**) +{ + test(); +#ifndef TEST_HAS_NO_WIDE_CHARACTERS + test(); +#endif +#if TEST_STD_VER >= 11 + test(); + test(); +#endif +#if TEST_STD_VER > 14 + static_assert(test(), ""); +#ifndef TEST_HAS_NO_WIDE_CHARACTERS + static_assert(test(), ""); +#endif + static_assert(test(), ""); + static_assert(test(), ""); +#endif + +#if TEST_STD_VER > 11 + test>>(); + static_assert(test>>(), ""); +#endif + +#if TEST_STD_VER > 17 + test(); + static_assert(test()); +#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 --- 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 -// -//===----------------------------------------------------------------------===// - -// - -// template -// constexpr bool operator==(basic_string_view lhs, const charT* rhs); -// template -// constexpr bool operator==(const charT* lhs, basic_string_view rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.h" - -template -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> 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 --- 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 -// -//===----------------------------------------------------------------------===// - -// - -// template -// bool operator==(const charT* lhs, const basic_string rhs); -// template -// bool operator==(const basic_string_view lhs, const CharT* rhs); - -#include -#include -#include - -#include "test_macros.h" - -template -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 --- 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 -// -//===----------------------------------------------------------------------===// - -// - -// template -// constexpr bool operator==(const basic_string_view lhs, -// const basic_string_view rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.h" - -template -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> 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 --- 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 -// -//===----------------------------------------------------------------------===// - -// - -// template -// constexpr bool operator>=(const charT* lhs, basic_string_view rhs); -// template -// constexpr bool operator>=(basic_string_view lhs, const charT* rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.h" - -template -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> 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 --- 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 -// -//===----------------------------------------------------------------------===// - -// - -// template -// bool operator>=(const basic_string& lhs, -// basic_string_view rhs); -// bool operator>=(basic_string_view lhs, -// const basic_string& rhs); - -#include -#include - -#include "test_macros.h" - -template -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 --- 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 -// -//===----------------------------------------------------------------------===// - -// - -// template -// constexpr bool operator>=(basic_string_view lhs, -// basic_string_view rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.h" - -template -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> 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 --- 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 -// -//===----------------------------------------------------------------------===// - -// - -// constexpr template -// bool operator>(const charT* lhs, basic_string_view rhs); -// constexpr template -// bool operator>(basic_string_view lhs, const charT* rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.h" - -template -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> 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 --- 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 -// -//===----------------------------------------------------------------------===// - -// - -// template -// bool operator>(const basic_string& lhs, -// basic_string_view rhs); -// bool operator>(basic_string_view lhs, -// const basic_string& rhs); - -#include -#include - -#include "test_macros.h" - -template -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 --- 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 -// -//===----------------------------------------------------------------------===// - -// - -// template -// constexpr bool operator>(basic_string_view lhs, -// basic_string_view rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.h" - -template -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> 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 --- 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 -// -//===----------------------------------------------------------------------===// - -// - -// template -// constexpr bool operator<=(const charT* lhs, basic_string_view rhs); -// template -// constexpr bool operator<=(basic_string_view lhs, const charT* rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.h" - -template -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> 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 --- 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 -// -//===----------------------------------------------------------------------===// - -// - -// template -// bool operator<=(const basic_string& lhs, -// basic_string_view rhs); -// bool operator<=(basic_string_view lhs, -// const basic_string& rhs); - -#include -#include - -#include "test_macros.h" - -template -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 --- 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 -// -//===----------------------------------------------------------------------===// - -// - -// template -// constexpr bool operator<=(basic_string_view lhs, -// basic_string_view rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.h" - -template -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> 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 --- 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 -// -//===----------------------------------------------------------------------===// - -// - -// template -// constexpr bool operator<(const charT* lhs, basic_string_view rhs); -// template -// constexpr bool operator<(basic_string_view lhs, const charT* rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.h" - -template -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> 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 --- 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 -// -//===----------------------------------------------------------------------===// - -// - -// template -// bool operator<(const basic_string& lhs, -// basic_string_view rhs); -// bool operator<(basic_string_view lhs, -// const basic_string& rhs); - -#include -#include - -#include "test_macros.h" - -template -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 --- 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 -// -//===----------------------------------------------------------------------===// - -// - -// template -// constexpr bool operator<(basic_string_view lhs, -// basic_string_view rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.h" - -template -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> 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 --- 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 -// -//===----------------------------------------------------------------------===// - -// - -// template -// constexpr bool operator!=(basic_string_view lhs, const charT* rhs); -// template -// constexpr bool operator!=(const charT* lhs, basic_string_view rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.h" - -template -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> 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 --- 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 -// -//===----------------------------------------------------------------------===// - -// - -// template -// bool operator!=(const basic_string &lhs, basic_string_view rhs); -// template -// bool operator!=(basic_string_view lhs, const basic_string &rhs); - -#include -#include -#include - -#include "test_macros.h" - -template -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 --- 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 -// -//===----------------------------------------------------------------------===// - -// - -// template -// constexpr bool operator!=(const basic_string_view lhs, -// const basic_string_view rhs); - -#include -#include - -#include "test_macros.h" -#include "constexpr_char_traits.h" - -template -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> SV; - constexpr SV sv1; - constexpr SV sv2; - constexpr SV sv3 { "abcde", 5 }; - static_assert (!( sv1 != sv2), "" ); - static_assert ( sv1 != sv3, "" ); - } -#endif - - return 0; -}