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, const charT* rhs);
14
15#include <string>
16#include <cassert>
17
18#include "min_allocator.h"
19
20template <class S>
21void
22test(const S& lhs, const typename S::value_type* rhs, bool x)
23{
24    assert((lhs != rhs) == x);
25}
26
27int 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(S("abcde"), "", true);
36    test(S("abcde"), "abcde", false);
37    test(S("abcde"), "abcdefghij", true);
38    test(S("abcde"), "abcdefghijklmnopqrst", true);
39    test(S("abcdefghij"), "", true);
40    test(S("abcdefghij"), "abcde", true);
41    test(S("abcdefghij"), "abcdefghij", false);
42    test(S("abcdefghij"), "abcdefghijklmnopqrst", true);
43    test(S("abcdefghijklmnopqrst"), "", true);
44    test(S("abcdefghijklmnopqrst"), "abcde", true);
45    test(S("abcdefghijklmnopqrst"), "abcdefghij", true);
46    test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false);
47    }
48#if __cplusplus >= 201103L
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(S("abcde"), "", true);
56    test(S("abcde"), "abcde", false);
57    test(S("abcde"), "abcdefghij", true);
58    test(S("abcde"), "abcdefghijklmnopqrst", true);
59    test(S("abcdefghij"), "", true);
60    test(S("abcdefghij"), "abcde", true);
61    test(S("abcdefghij"), "abcdefghij", false);
62    test(S("abcdefghij"), "abcdefghijklmnopqrst", true);
63    test(S("abcdefghijklmnopqrst"), "", true);
64    test(S("abcdefghijklmnopqrst"), "abcde", true);
65    test(S("abcdefghijklmnopqrst"), "abcdefghij", true);
66    test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false);
67    }
68#endif
69}
70