pointer_string.pass.cpp revision b64f8b07c104c6cc986570ac8ee0ed16a9f23976
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 charT* lhs, const basic_string<charT,traits,Allocator>& rhs);
14
15#include <string>
16#include <cassert>
17
18template <class S>
19void
20test(const typename S::value_type* lhs, const S& rhs, bool x)
21{
22    assert((lhs > rhs) == x);
23}
24
25typedef std::string S;
26
27int main()
28{
29    test("", S(""), false);
30    test("", S("abcde"), false);
31    test("", S("abcdefghij"), false);
32    test("", S("abcdefghijklmnopqrst"), false);
33    test("abcde", S(""), true);
34    test("abcde", S("abcde"), false);
35    test("abcde", S("abcdefghij"), false);
36    test("abcde", S("abcdefghijklmnopqrst"), false);
37    test("abcdefghij", S(""), true);
38    test("abcdefghij", S("abcde"), true);
39    test("abcdefghij", S("abcdefghij"), false);
40    test("abcdefghij", S("abcdefghijklmnopqrst"), false);
41    test("abcdefghijklmnopqrst", S(""), true);
42    test("abcdefghijklmnopqrst", S("abcde"), true);
43    test("abcdefghijklmnopqrst", S("abcdefghij"), true);
44    test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false);
45}
46