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