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