1 //===----------------------------------------------------------------------===// 2 // 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 6 // 7 //===----------------------------------------------------------------------===// 8 9 // XFAIL: LIBCXX-AIX-FIXME 10 11 // <string> 12 13 // template<class charT, class traits, class Allocator> 14 // bool operator>(const charT* lhs, const basic_string<charT,traits,Allocator>& rhs); // constexpr since C++20 15 16 #include <string> 17 #include <cassert> 18 19 #include "test_macros.h" 20 #include "min_allocator.h" 21 22 template <class S> 23 TEST_CONSTEXPR_CXX20 void 24 test(const typename S::value_type* lhs, const S& rhs, bool x) 25 { 26 assert((lhs > rhs) == x); 27 } 28 29 TEST_CONSTEXPR_CXX20 bool test() { 30 { 31 typedef std::string S; 32 test("", S(""), false); 33 test("", S("abcde"), false); 34 test("", S("abcdefghij"), false); 35 test("", S("abcdefghijklmnopqrst"), false); 36 test("abcde", S(""), true); 37 test("abcde", S("abcde"), false); 38 test("abcde", S("abcdefghij"), false); 39 test("abcde", S("abcdefghijklmnopqrst"), false); 40 test("abcdefghij", S(""), true); 41 test("abcdefghij", S("abcde"), true); 42 test("abcdefghij", S("abcdefghij"), false); 43 test("abcdefghij", S("abcdefghijklmnopqrst"), false); 44 test("abcdefghijklmnopqrst", S(""), true); 45 test("abcdefghijklmnopqrst", S("abcde"), true); 46 test("abcdefghijklmnopqrst", S("abcdefghij"), true); 47 test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false); 48 } 49 #if TEST_STD_VER >= 11 50 { 51 typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; 52 test("", S(""), false); 53 test("", S("abcde"), false); 54 test("", S("abcdefghij"), false); 55 test("", S("abcdefghijklmnopqrst"), false); 56 test("abcde", S(""), true); 57 test("abcde", S("abcde"), false); 58 test("abcde", S("abcdefghij"), false); 59 test("abcde", S("abcdefghijklmnopqrst"), false); 60 test("abcdefghij", S(""), true); 61 test("abcdefghij", S("abcde"), true); 62 test("abcdefghij", S("abcdefghij"), false); 63 test("abcdefghij", S("abcdefghijklmnopqrst"), false); 64 test("abcdefghijklmnopqrst", S(""), true); 65 test("abcdefghijklmnopqrst", S("abcde"), true); 66 test("abcdefghijklmnopqrst", S("abcdefghij"), true); 67 test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false); 68 } 69 #endif 70 71 return true; 72 } 73 74 int main(int, char**) 75 { 76 test(); 77 #if TEST_STD_VER > 17 78 static_assert(test()); 79 #endif 80 81 return 0; 82 } 83