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