1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 // template<class charT, class traits, class Allocator>
12 // bool operator>(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs); // constexpr since C++20
17 #include "test_macros.h"
18 #include "min_allocator.h"
21 TEST_CONSTEXPR_CXX20
void test(const S
& lhs
, const typename
S::value_type
* rhs
, bool x
) {
22 assert((lhs
> rhs
) == x
);
26 TEST_CONSTEXPR_CXX20
void test_string() {
27 test(S(""), "", false);
28 test(S(""), "abcde", false);
29 test(S(""), "abcdefghij", false);
30 test(S(""), "abcdefghijklmnopqrst", false);
31 test(S("abcde"), "", true);
32 test(S("abcde"), "abcde", false);
33 test(S("abcde"), "abcdefghij", false);
34 test(S("abcde"), "abcdefghijklmnopqrst", false);
35 test(S("abcdefghij"), "", true);
36 test(S("abcdefghij"), "abcde", true);
37 test(S("abcdefghij"), "abcdefghij", false);
38 test(S("abcdefghij"), "abcdefghijklmnopqrst", false);
39 test(S("abcdefghijklmnopqrst"), "", true);
40 test(S("abcdefghijklmnopqrst"), "abcde", true);
41 test(S("abcdefghijklmnopqrst"), "abcdefghij", true);
42 test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false);
45 TEST_CONSTEXPR_CXX20
bool test() {
46 test_string
<std::string
>();
47 #if TEST_STD_VER >= 11
48 test_string
<std::basic_string
<char, std::char_traits
<char>, min_allocator
<char> > >();
54 int main(int, char**) {
57 static_assert(test());