Index: libcxx/include/string =================================================================== --- libcxx/include/string +++ libcxx/include/string @@ -356,63 +356,70 @@ template bool operator==(const basic_string& lhs, - const basic_string& rhs) noexcept; + const basic_string& rhs) noexcept; template -bool operator==(const charT* lhs, const basic_string& rhs) noexcept; +bool operator==(const basic_string& lhs, const charT* rhs) noexcept; template -bool operator==(const basic_string& lhs, const charT* rhs) noexcept; +bool operator==(const basic_string& lhs, const charT* rhs) noexcept; // C++17 template bool operator!=(const basic_string& lhs, - const basic_string& rhs) noexcept; + const basic_string& rhs) noexcept; // C++17 template -bool operator!=(const charT* lhs, const basic_string& rhs) noexcept; +bool operator!=(const charT* lhs, const basic_string& rhs) noexcept; // C++17 template -bool operator!=(const basic_string& lhs, const charT* rhs) noexcept; +bool operator!=(const basic_string& lhs, const charT* rhs) noexcept; // C++17 template bool operator< (const basic_string& lhs, - const basic_string& rhs) noexcept; + const basic_string& rhs) noexcept; // C++17 template -bool operator< (const basic_string& lhs, const charT* rhs) noexcept; +bool operator< (const basic_string& lhs, const charT* rhs) noexcept; // C++17 template -bool operator< (const charT* lhs, const basic_string& rhs) noexcept; +bool operator< (const charT* lhs, const basic_string& rhs) noexcept; // C++17 template bool operator> (const basic_string& lhs, - const basic_string& rhs) noexcept; + const basic_string& rhs) noexcept; // C++17 template -bool operator> (const basic_string& lhs, const charT* rhs) noexcept; +bool operator> (const basic_string& lhs, const charT* rhs) noexcept; // C++17 template -bool operator> (const charT* lhs, const basic_string& rhs) noexcept; +bool operator> (const charT* lhs, const basic_string& rhs) noexcept; // C++17 template -bool operator<=(const basic_string& lhs, +bool operator<=(const basic_string& lhs, // C++17 const basic_string& rhs) noexcept; template -bool operator<=(const basic_string& lhs, const charT* rhs) noexcept; +bool operator<=(const basic_string& lhs, const charT* rhs) noexcept; // C++17 template -bool operator<=(const charT* lhs, const basic_string& rhs) noexcept; +bool operator<=(const charT* lhs, const basic_string& rhs) noexcept; // C++17 template -bool operator>=(const basic_string& lhs, +bool operator>=(const basic_string& lhs, // C++17 const basic_string& rhs) noexcept; template -bool operator>=(const basic_string& lhs, const charT* rhs) noexcept; +bool operator>=(const basic_string& lhs, const charT* rhs) noexcept; // C++17 + +template +bool operator>=(const charT* lhs, const basic_string& rhs) noexcept; // C++17 template -bool operator>=(const charT* lhs, const basic_string& rhs) noexcept; +bool operator<=>(const basic_string& lhs, + const basic_string& rhs) noexcept; // C++20 + +template +operator<=>(const basic_string& lhs, const charT* rhs) noexcept; // C++20 template void swap(basic_string& lhs, @@ -3935,19 +3942,6 @@ } // operator== - -template -inline _LIBCPP_INLINE_VISIBILITY -bool -operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs, - const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT -{ - size_t __lhs_sz = __lhs.size(); - return __lhs_sz == __rhs.size() && _Traits::compare(__lhs.data(), - __rhs.data(), - __lhs_sz) == 0; -} - template inline _LIBCPP_INLINE_VISIBILITY bool @@ -3967,6 +3961,58 @@ return true; } +#if !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) +// operator== +template +_LIBCPP_INLINE_VISIBILITY +bool +operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs, + const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT +{ + return basic_string_view<_CharT, _Traits>(__lhs) == basic_string_view<_CharT, _Traits>(__rhs); +} + +template +_LIBCPP_INLINE_VISIBILITY +bool +operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs, + const _CharT* __rhs) _NOEXCEPT +{ + return basic_string_view<_CharT, _Traits>(__lhs) == basic_string_view<_CharT, _Traits>(__rhs); +} + +// operator<=> +template +_LIBCPP_INLINE_VISIBILITY +auto +operator<=>(const basic_string<_CharT, _Traits, _Allocator>& __lhs, + const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT +{ + return basic_string_view<_CharT, _Traits>(__lhs) <=> basic_string_view<_CharT, _Traits>(__rhs); +} + +template +_LIBCPP_INLINE_VISIBILITY +auto +operator<=>(const basic_string<_CharT, _Traits, _Allocator>& __lhs, + const _CharT* __rhs) _NOEXCEPT +{ + return basic_string_view<_CharT, _Traits>(__lhs) <=> basic_string_view<_CharT, _Traits>(__rhs); +} +#else +// operator== +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs, + const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT +{ + size_t __lhs_sz = __lhs.size(); + return __lhs_sz == __rhs.size() && _Traits::compare(__lhs.data(), + __rhs.data(), + __lhs_sz) == 0; +} + template inline _LIBCPP_INLINE_VISIBILITY bool @@ -4135,6 +4181,7 @@ { return !(__lhs < __rhs); } +#endif // _LIBCPP_HAS_NO_SPACESHIP_OPERATOR // operator + Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_opcmp/pointer_string.pass.cpp =================================================================== --- /dev/null +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_opcmp/pointer_string.pass.cpp @@ -0,0 +1,81 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 + +// + +// template +// bool operator<=>(const charT* lhs, const basic_string& rhs); + +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +template +void +test(const typename S::value_type* lhs, const S& rhs, std::weak_ordering x) +{ + assert((lhs <=> rhs) == x); +} + + +int main(int, char**) +{ + { + typedef std::string S; + test("abc", S("acb"), std::strong_ordering::less); + test("acb", S("abc"), std::strong_ordering::greater); + test("aaa", S("cba"), std::strong_ordering::less); + test("cba", S("aaa"), std::strong_ordering::greater); + } + { + typedef std::string S; + test("", S(""), std::strong_ordering::equal); + test("", S("abcde"), std::strong_ordering::less); + test("", S("abcdefghij"), std::strong_ordering::less); + test("", S("abcdefghijklmnopqrst"), std::strong_ordering::less); + test("abcde", S(""), std::strong_ordering::greater); + test("abcde", S("abcde"), std::strong_ordering::equal); + test("abcde", S("abcdefghij"), std::strong_ordering::less); + test("abcde", S("abcdefghijklmnopqrst"), std::strong_ordering::less); + test("abcdefghij", S(""), std::strong_ordering::greater); + test("abcdefghij", S("abcde"), std::strong_ordering::greater); + test("abcdefghij", S("abcdefghij"), std::strong_ordering::equal); + test("abcdefghij", S("abcdefghijklmnopqrst"), std::strong_ordering::less); + test("abcdefghijklmnopqrst", S(""), std::strong_ordering::greater); + test("abcdefghijklmnopqrst", S("abcde"), std::strong_ordering::greater); + test("abcdefghijklmnopqrst", S("abcdefghij"), std::strong_ordering::greater); + test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), std::strong_ordering::equal); + } + + { + typedef std::basic_string, min_allocator> S; + test("", S(""), std::weak_ordering::equivalent); + test("", S("abcde"), std::weak_ordering::less); + test("", S("abcdefghij"), std::weak_ordering::less); + test("", S("abcdefghijklmnopqrst"), std::weak_ordering::less); + test("abcde", S(""), std::weak_ordering::greater); + test("abcde", S("abcde"), std::weak_ordering::equivalent); + test("abcde", S("abcdefghij"), std::weak_ordering::less); + test("abcde", S("abcdefghijklmnopqrst"), std::weak_ordering::less); + test("abcdefghij", S(""), std::weak_ordering::greater); + test("abcdefghij", S("abcde"), std::weak_ordering::greater); + test("abcdefghij", S("abcdefghij"), std::weak_ordering::equivalent); + test("abcdefghij", S("abcdefghijklmnopqrst"), std::weak_ordering::less); + test("abcdefghijklmnopqrst", S(""), std::weak_ordering::greater); + test("abcdefghijklmnopqrst", S("abcde"), std::weak_ordering::greater); + test("abcdefghijklmnopqrst", S("abcdefghij"), std::weak_ordering::greater); + test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), std::weak_ordering::equivalent); + } + + return 0; +} Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_opcmp/string_pointer.pass.cpp =================================================================== --- /dev/null +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_opcmp/string_pointer.pass.cpp @@ -0,0 +1,80 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 + +// + +// template +// bool operator>(const basic_string& lhs, const charT* rhs); + +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +template +void +test(const S& lhs, const typename S::value_type* rhs, std::weak_ordering x) +{ + assert((lhs <=> rhs) == x); +} + +int main(int, char**) +{ + { + typedef std::string S; + test(S("abc"), "acb", std::strong_ordering::less); + test(S("acb"), "abc", std::strong_ordering::greater); + test(S("aaa"), "cba", std::strong_ordering::less); + test(S("cba"), "aaa", std::strong_ordering::greater); + } + { + typedef std::string S; + test(S(""), "", std::strong_ordering::equal); + test(S(""), "abcde", std::strong_ordering::less); + test(S(""), "abcdefghij", std::strong_ordering::less); + test(S(""), "abcdefghijklmnopqrst", std::strong_ordering::less); + test(S("abcde"), "", std::strong_ordering::greater); + test(S("abcde"), "abcde", std::strong_ordering::equal); + test(S("abcde"), "abcdefghij", std::strong_ordering::less); + test(S("abcde"), "abcdefghijklmnopqrst", std::strong_ordering::less); + test(S("abcdefghij"), "", std::strong_ordering::greater); + test(S("abcdefghij"), "abcde", std::strong_ordering::greater); + test(S("abcdefghij"), "abcdefghij", std::strong_ordering::equal); + test(S("abcdefghij"), "abcdefghijklmnopqrst", std::strong_ordering::less); + test(S("abcdefghijklmnopqrst"), "", std::strong_ordering::greater); + test(S("abcdefghijklmnopqrst"), "abcde", std::strong_ordering::greater); + test(S("abcdefghijklmnopqrst"), "abcdefghij", std::strong_ordering::greater); + test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", std::strong_ordering::equal); + } + + { + typedef std::basic_string, min_allocator> S; + test(S(""), "", std::weak_ordering::equivalent); + test(S(""), "abcde", std::weak_ordering::less); + test(S(""), "abcdefghij", std::weak_ordering::less); + test(S(""), "abcdefghijklmnopqrst", std::weak_ordering::less); + test(S("abcde"), "", std::weak_ordering::greater); + test(S("abcde"), "abcde", std::weak_ordering::equivalent); + test(S("abcde"), "abcdefghij", std::weak_ordering::less); + test(S("abcde"), "abcdefghijklmnopqrst", std::weak_ordering::less); + test(S("abcdefghij"), "", std::weak_ordering::greater); + test(S("abcdefghij"), "abcde", std::weak_ordering::greater); + test(S("abcdefghij"), "abcdefghij", std::weak_ordering::equivalent); + test(S("abcdefghij"), "abcdefghijklmnopqrst", std::weak_ordering::less); + test(S("abcdefghijklmnopqrst"), "", std::weak_ordering::greater); + test(S("abcdefghijklmnopqrst"), "abcde", std::weak_ordering::greater); + test(S("abcdefghijklmnopqrst"), "abcdefghij", std::weak_ordering::greater); + test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", std::weak_ordering::equivalent); + } + + return 0; +} Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_opcmp/string_string.pass.cpp =================================================================== --- /dev/null +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_opcmp/string_string.pass.cpp @@ -0,0 +1,79 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 + +// + +// we get this comparison "for free" because the string implicitly converts to the string_view + +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +template +void +test(const S& lhs, const S& rhs, std::weak_ordering x) +{ + assert((lhs <=> rhs) == x); +} + +int main(int, char**) +{ + { + typedef std::string S; + test(S("abc"), S("acb"), std::strong_ordering::less); + test(S("acb"), S("abc"), std::strong_ordering::greater); + test(S("aaa"), S("cba"), std::strong_ordering::less); + test(S("cba"), S("aaa"), std::strong_ordering::greater); + } + { + typedef std::string S; + test(S(""), S(""), std::strong_ordering::equal); + test(S(""), S("abcde"), std::strong_ordering::less); + test(S(""), S("abcdefghij"), std::strong_ordering::less); + test(S(""), S("abcdefghijklmnopqrst"), std::strong_ordering::less); + test(S("abcde"), S(""), std::strong_ordering::greater); + test(S("abcde"), S("abcde"), std::strong_ordering::equal); + test(S("abcde"), S("abcdefghij"), std::strong_ordering::less); + test(S("abcde"), S("abcdefghijklmnopqrst"), std::strong_ordering::less); + test(S("abcdefghij"), S(""), std::strong_ordering::greater); + test(S("abcdefghij"), S("abcde"), std::strong_ordering::greater); + test(S("abcdefghij"), S("abcdefghij"), std::strong_ordering::equal); + test(S("abcdefghij"), S("abcdefghijklmnopqrst"), std::strong_ordering::less); + test(S("abcdefghijklmnopqrst"), S(""), std::strong_ordering::greater); + test(S("abcdefghijklmnopqrst"), S("abcde"), std::strong_ordering::greater); + test(S("abcdefghijklmnopqrst"), S("abcdefghij"), std::strong_ordering::greater); + test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), std::strong_ordering::equal); + } + + { + typedef std::basic_string , min_allocator> S; + test(S(""), S(""), std::weak_ordering::equivalent); + test(S(""), S("abcde"), std::weak_ordering::less); + test(S(""), S("abcdefghij"), std::weak_ordering::less); + test(S(""), S("abcdefghijklmnopqrst"), std::weak_ordering::less); + test(S("abcde"), S(""), std::weak_ordering::greater); + test(S("abcde"), S("abcde"), std::weak_ordering::equivalent); + test(S("abcde"), S("abcdefghij"), std::weak_ordering::less); + test(S("abcde"), S("abcdefghijklmnopqrst"), std::weak_ordering::less); + test(S("abcdefghij"), S(""), std::weak_ordering::greater); + test(S("abcdefghij"), S("abcde"), std::weak_ordering::greater); + test(S("abcdefghij"), S("abcdefghij"), std::weak_ordering::equivalent); + test(S("abcdefghij"), S("abcdefghijklmnopqrst"), std::weak_ordering::less); + test(S("abcdefghijklmnopqrst"), S(""), std::weak_ordering::greater); + test(S("abcdefghijklmnopqrst"), S("abcde"), std::weak_ordering::greater); + test(S("abcdefghijklmnopqrst"), S("abcdefghij"), std::weak_ordering::greater); + test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), std::weak_ordering::equivalent); + } + + return 0; +} Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_opcmp/string_string_view.pass.cpp =================================================================== --- /dev/null +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_opcmp/string_string_view.pass.cpp @@ -0,0 +1,82 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 + +// + +// we get this comparison "for free" because the string implicitly converts to the string_view + +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +template +void +test(const S& lhs, SV rhs, std::weak_ordering x) +{ + assert((lhs <=> rhs) == x); +} + +int main(int, char**) +{ + { + typedef std::string S; + typedef std::string_view SV; + test(S("abc"), SV("acb"), std::strong_ordering::less); + test(S("acb"), SV("abc"), std::strong_ordering::greater); + test(S("aaa"), SV("cba"), std::strong_ordering::less); + test(S("cba"), SV("aaa"), std::strong_ordering::greater); + } + { + typedef std::string S; + typedef std::string_view SV; + test(S(""), SV(""), std::strong_ordering::equal); + test(S(""), SV("abcde"), std::strong_ordering::less); + test(S(""), SV("abcdefghij"), std::strong_ordering::less); + test(S(""), SV("abcdefghijklmnopqrst"), std::strong_ordering::less); + test(S("abcde"), SV(""), std::strong_ordering::greater); + test(S("abcde"), SV("abcde"), std::strong_ordering::equal); + test(S("abcde"), SV("abcdefghij"), std::strong_ordering::less); + test(S("abcde"), SV("abcdefghijklmnopqrst"), std::strong_ordering::less); + test(S("abcdefghij"), SV(""), std::strong_ordering::greater); + test(S("abcdefghij"), SV("abcde"), std::strong_ordering::greater); + test(S("abcdefghij"), SV("abcdefghij"), std::strong_ordering::equal); + test(S("abcdefghij"), SV("abcdefghijklmnopqrst"), std::strong_ordering::less); + test(S("abcdefghijklmnopqrst"), SV(""), std::strong_ordering::greater); + test(S("abcdefghijklmnopqrst"), SV("abcde"), std::strong_ordering::greater); + test(S("abcdefghijklmnopqrst"), SV("abcdefghij"), std::strong_ordering::greater); + test(S("abcdefghijklmnopqrst"), SV("abcdefghijklmnopqrst"), std::strong_ordering::equal); + } + + { + typedef std::basic_string , min_allocator> S; + typedef std::basic_string_view> SV; + test(S(""), SV(""), std::weak_ordering::equivalent); + test(S(""), SV("abcde"), std::weak_ordering::less); + test(S(""), SV("abcdefghij"), std::weak_ordering::less); + test(S(""), SV("abcdefghijklmnopqrst"), std::weak_ordering::less); + test(S("abcde"), SV(""), std::weak_ordering::greater); + test(S("abcde"), SV("abcde"), std::weak_ordering::equivalent); + test(S("abcde"), SV("abcdefghij"), std::weak_ordering::less); + test(S("abcde"), SV("abcdefghijklmnopqrst"), std::weak_ordering::less); + test(S("abcdefghij"), SV(""), std::weak_ordering::greater); + test(S("abcdefghij"), SV("abcde"), std::weak_ordering::greater); + test(S("abcdefghij"), SV("abcdefghij"), std::weak_ordering::equivalent); + test(S("abcdefghij"), SV("abcdefghijklmnopqrst"), std::weak_ordering::less); + test(S("abcdefghijklmnopqrst"), SV(""), std::weak_ordering::greater); + test(S("abcdefghijklmnopqrst"), SV("abcde"), std::weak_ordering::greater); + test(S("abcdefghijklmnopqrst"), SV("abcdefghij"), std::weak_ordering::greater); + test(S("abcdefghijklmnopqrst"), SV("abcdefghijklmnopqrst"), std::weak_ordering::equivalent); + } + + return 0; +} Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_opcmp/string_view_string.pass.cpp =================================================================== --- /dev/null +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_opcmp/string_view_string.pass.cpp @@ -0,0 +1,82 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 + +// + +// we get this comparison "for free" because the string implicitly converts to the string_view + +#include +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +template +void +test(SV lhs, const S& rhs, std::weak_ordering x) +{ + assert((lhs <=> rhs) == x); +} + +int main(int, char**) +{ + { + typedef std::string S; + typedef std::string_view SV; + test(SV("abc"), S("acb"), std::strong_ordering::less); + test(SV("acb"), S("abc"), std::strong_ordering::greater); + test(SV("aaa"), S("cba"), std::strong_ordering::less); + test(SV("cba"), S("aaa"), std::strong_ordering::greater); + } + { + typedef std::string S; + typedef std::string_view SV; + test(SV(""), S(""), std::strong_ordering::equal); + test(SV(""), S("abcde"), std::strong_ordering::less); + test(SV(""), S("abcdefghij"), std::strong_ordering::less); + test(SV(""), S("abcdefghijklmnopqrst"), std::strong_ordering::less); + test(SV("abcde"), S(""), std::strong_ordering::greater); + test(SV("abcde"), S("abcde"), std::strong_ordering::equal); + test(SV("abcde"), S("abcdefghij"), std::strong_ordering::less); + test(SV("abcde"), S("abcdefghijklmnopqrst"), std::strong_ordering::less); + test(SV("abcdefghij"), S(""), std::strong_ordering::greater); + test(SV("abcdefghij"), S("abcde"), std::strong_ordering::greater); + test(SV("abcdefghij"), S("abcdefghij"), std::strong_ordering::equal); + test(SV("abcdefghij"), S("abcdefghijklmnopqrst"), std::strong_ordering::less); + test(SV("abcdefghijklmnopqrst"), S(""), std::strong_ordering::greater); + test(SV("abcdefghijklmnopqrst"), S("abcde"), std::strong_ordering::greater); + test(SV("abcdefghijklmnopqrst"), S("abcdefghij"), std::strong_ordering::greater); + test(SV("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), std::strong_ordering::equal); + } + + { + typedef std::basic_string , min_allocator> S; + typedef std::basic_string_view> SV; + test(SV(""), S(""), std::weak_ordering::equivalent); + test(SV(""), S("abcde"), std::weak_ordering::less); + test(SV(""), S("abcdefghij"), std::weak_ordering::less); + test(SV(""), S("abcdefghijklmnopqrst"), std::weak_ordering::less); + test(SV("abcde"), S(""), std::weak_ordering::greater); + test(SV("abcde"), S("abcde"), std::weak_ordering::equivalent); + test(SV("abcde"), S("abcdefghij"), std::weak_ordering::less); + test(SV("abcde"), S("abcdefghijklmnopqrst"), std::weak_ordering::less); + test(SV("abcdefghij"), S(""), std::weak_ordering::greater); + test(SV("abcdefghij"), S("abcde"), std::weak_ordering::greater); + test(SV("abcdefghij"), S("abcdefghij"), std::weak_ordering::equivalent); + test(SV("abcdefghij"), S("abcdefghijklmnopqrst"), std::weak_ordering::less); + test(SV("abcdefghijklmnopqrst"), S(""), std::weak_ordering::greater); + test(SV("abcdefghijklmnopqrst"), S("abcde"), std::weak_ordering::greater); + test(SV("abcdefghijklmnopqrst"), S("abcdefghij"), std::weak_ordering::greater); + test(SV("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), std::weak_ordering::equivalent); + } + + return 0; +} Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/pointer_string.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/pointer_string.pass.cpp +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/pointer_string.pass.cpp @@ -26,6 +26,13 @@ int main(int, char**) { + { + typedef std::string S; + test("abc", S("acb"), false); + test("acb", S("abc"), true); + test("aaa", S("cba"), false); + test("cba", S("aaa"), true); + } { typedef std::string S; test("", S(""), false); Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_pointer.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_pointer.pass.cpp +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_pointer.pass.cpp @@ -26,6 +26,13 @@ int main(int, char**) { + { + typedef std::string S; + test(S("abc"), "acb", false); + test(S("acb"), "abc", true); + test(S("aaa"), "cba", false); + test(S("cba"), "aaa", true); + } { typedef std::string S; test(S(""), "", false); Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_string.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_string.pass.cpp +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_string.pass.cpp @@ -27,6 +27,13 @@ int main(int, char**) { + { + typedef std::string S; + test(S("abc"), S("acb"), false); + test(S("acb"), S("abc"), true); + test(S("aaa"), S("cba"), false); + test(S("cba"), S("aaa"), true); + } { typedef std::string S; test(S(""), S(""), false); Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_string_view.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_string_view.pass.cpp +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_string_view.pass.cpp @@ -25,6 +25,14 @@ int main(int, char**) { + { + typedef std::string S; + typedef std::string_view SV; + test(S("abc"), SV("acb"), false); + test(S("acb"), SV("abc"), true); + test(S("aaa"), SV("cba"), false); + test(S("cba"), SV("aaa"), true); + } { typedef std::string S; typedef std::string_view SV; Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_view_string.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_view_string.pass.cpp +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_view_string.pass.cpp @@ -25,6 +25,14 @@ int main(int, char**) { + { + typedef std::string S; + typedef std::string_view SV; + test(SV("abc"), S("acb"), false); + test(SV("acb"), S("abc"), true); + test(SV("aaa"), S("cba"), false); + test(SV("cba"), S("aaa"), true); + } { typedef std::string S; typedef std::string_view SV; Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/pointer_string.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/pointer_string.pass.cpp +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/pointer_string.pass.cpp @@ -26,6 +26,13 @@ int main(int, char**) { + { + typedef std::string S; + test("abc", S("acb"), false); + test("acb", S("abc"), true); + test("aaa", S("cba"), false); + test("cba", S("aaa"), true); + } { typedef std::string S; test("", S(""), true); Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_pointer.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_pointer.pass.cpp +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_pointer.pass.cpp @@ -26,6 +26,13 @@ int main(int, char**) { + { + typedef std::string S; + test(S("abc"), "acb", false); + test(S("acb"), "abc", true); + test(S("aaa"), "cba", false); + test(S("cba"), "aaa", true); + } { typedef std::string S; test(S(""), "", true); Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string.pass.cpp +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string.pass.cpp @@ -27,6 +27,13 @@ int main(int, char**) { + { + typedef std::string S; + test(S("abc"), S("acb"), false); + test(S("acb"), S("abc"), true); + test(S("aaa"), S("cba"), false); + test(S("cba"), S("aaa"), true); + } { typedef std::string S; test(S(""), S(""), true); Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string_view.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string_view.pass.cpp +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string_view.pass.cpp @@ -25,6 +25,14 @@ int main(int, char**) { + { + typedef std::string S; + typedef std::string_view SV; + test(S("abc"), SV("acb"), false); + test(S("acb"), SV("abc"), true); + test(S("aaa"), SV("cba"), false); + test(S("cba"), SV("aaa"), true); + } { typedef std::string S; typedef std::string_view SV; Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_view_string.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_view_string.pass.cpp +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_view_string.pass.cpp @@ -25,6 +25,14 @@ int main(int, char**) { + { + typedef std::string S; + typedef std::string_view SV; + test(SV("abc"), S("acb"), false); + test(SV("acb"), S("abc"), true); + test(SV("aaa"), S("cba"), false); + test(SV("cba"), S("aaa"), true); + } { typedef std::string S; typedef std::string_view SV; Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/pointer_string.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/pointer_string.pass.cpp +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/pointer_string.pass.cpp @@ -26,6 +26,13 @@ int main(int, char**) { + { + typedef std::string S; + test("abc", S("acb"), true); + test("acb", S("abc"), false); + test("aaa", S("cba"), true); + test("cba", S("aaa"), false); + } { typedef std::string S; test("", S(""), false); Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_pointer.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_pointer.pass.cpp +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_pointer.pass.cpp @@ -26,6 +26,13 @@ int main(int, char**) { + { + typedef std::string S; + test(S("abc"), "acb", true); + test(S("acb"), "abc", false); + test(S("aaa"), "cba", true); + test(S("cba"), "aaa", false); + } { typedef std::string S; test(S(""), "", false); Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_string.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_string.pass.cpp +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_string.pass.cpp @@ -27,6 +27,13 @@ int main(int, char**) { + { + typedef std::string S; + test(S("abc"), S("acb"), true); + test(S("acb"), S("abc"), false); + test(S("aaa"), S("cba"), true); + test(S("cba"), S("aaa"), false); + } { typedef std::string S; test(S(""), S(""), false); Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_string_view.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_string_view.pass.cpp +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_string_view.pass.cpp @@ -25,6 +25,14 @@ int main(int, char**) { + { + typedef std::string S; + typedef std::string_view SV; + test(S("abc"), SV("acb"), true); + test(S("acb"), SV("abc"), false); + test(S("aaa"), SV("cba"), true); + test(S("cba"), SV("aaa"), false); + } { typedef std::string S; typedef std::string_view SV; Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_view_string.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_view_string.pass.cpp +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_view_string.pass.cpp @@ -25,6 +25,14 @@ int main(int, char**) { + { + typedef std::string S; + typedef std::string_view SV; + test(SV("abc"), S("acb"), true); + test(SV("acb"), S("abc"), false); + test(SV("aaa"), S("cba"), true); + test(SV("cba"), S("aaa"), false); + } { typedef std::string S; typedef std::string_view SV; Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp @@ -26,6 +26,13 @@ int main(int, char**) { + { + typedef std::string S; + test("abc", S("acb"), true); + test("acb", S("abc"), false); + test("aaa", S("cba"), true); + test("cba", S("aaa"), false); + } { typedef std::string S; test("", S(""), true); Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_pointer.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_pointer.pass.cpp +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_pointer.pass.cpp @@ -26,6 +26,13 @@ int main(int, char**) { + { + typedef std::string S; + test(S("abc"), "acb", true); + test(S("acb"), "abc", false); + test(S("aaa"), "cba", true); + test(S("cba"), "aaa", false); + } { typedef std::string S; test(S(""), "", true); Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string.pass.cpp +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string.pass.cpp @@ -27,6 +27,13 @@ int main(int, char**) { + { + typedef std::string S; + test(S("abc"), S("acb"), true); + test(S("acb"), S("abc"), false); + test(S("aaa"), S("cba"), true); + test(S("cba"), S("aaa"), false); + } { typedef std::string S; test(S(""), S(""), true); Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string_view.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string_view.pass.cpp +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string_view.pass.cpp @@ -25,6 +25,14 @@ int main(int, char**) { + { + typedef std::string S; + typedef std::string_view SV; + test(SV("abc"), "acb", true); + test(SV("acb"), "abc", false); + test(SV("aaa"), "cba", true); + test(SV("cba"), "aaa", false); + } { typedef std::string S; typedef std::string_view SV; Index: libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_view_string.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_view_string.pass.cpp +++ libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_view_string.pass.cpp @@ -25,6 +25,14 @@ int main(int, char**) { + { + typedef std::string S; + typedef std::string_view SV; + test(SV("abc"), S("acb"), true); + test(SV("acb"), S("abc"), false); + test(SV("aaa"), S("cba"), true); + test(SV("cba"), S("aaa"), false); + } { typedef std::string S; typedef std::string_view SV;