• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <string>
11 
12 // template<class charT, class traits, class Allocator>
13 //   bool operator>(const basic_string<charT,traits,Allocator>& lhs,
14 //                   basic_string_view<charT,traits> rhs);
15 //   bool operator>(basic_string_view<charT,traits> lhs,
16 //            const basic_string<charT,traits,Allocator>&  rhs);
17 
18 #include <experimental/string_view>
19 #include <cassert>
20 
21 template <class S>
22 void
test(const S & lhs,const typename S::value_type * rhs,bool x,bool y)23 test(const S& lhs, const typename S::value_type* rhs, bool x, bool y)
24 {
25     assert((lhs > rhs) == x);
26     assert((rhs > lhs) == y);
27 }
28 
main()29 int main()
30 {
31     {
32     typedef std::experimental::string_view S;
33     test(S(""), "", false, false);
34     test(S(""), "abcde", false, true);
35     test(S(""), "abcdefghij", false, true);
36     test(S(""), "abcdefghijklmnopqrst", false, true);
37     test(S("abcde"), "", true, false);
38     test(S("abcde"), "abcde", false, false);
39     test(S("abcde"), "abcdefghij", false, true);
40     test(S("abcde"), "abcdefghijklmnopqrst", false, true);
41     test(S("abcdefghij"), "", true, false);
42     test(S("abcdefghij"), "abcde", true, false);
43     test(S("abcdefghij"), "abcdefghij", false, false);
44     test(S("abcdefghij"), "abcdefghijklmnopqrst", false, true);
45     test(S("abcdefghijklmnopqrst"), "", true, false);
46     test(S("abcdefghijklmnopqrst"), "abcde", true, false);
47     test(S("abcdefghijklmnopqrst"), "abcdefghij", true, false);
48     test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false, false);
49     }
50 }
51