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