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> rhs);
14// template<class charT, class traits, class Allocator>
15//   bool operator==(const basic_string_view<charT,traits> lhs, const CharT* rhs);
16
17#include <experimental/string_view>
18#include <cassert>
19
20template <class S>
21void
22test(const std::string &lhs, S rhs, bool x)
23{
24    assert((lhs == rhs) == x);
25    assert((rhs == lhs) == x);
26}
27
28int main()
29{
30    {
31    typedef std::experimental::string_view S;
32    test("", S(""), true);
33    test("", S("abcde"), false);
34    test("", S("abcdefghij"), false);
35    test("", S("abcdefghijklmnopqrst"), false);
36    test("abcde", S(""), false);
37    test("abcde", S("abcde"), true);
38    test("abcde", S("abcdefghij"), false);
39    test("abcde", S("abcdefghijklmnopqrst"), false);
40    test("abcdefghij", S(""), false);
41    test("abcdefghij", S("abcde"), false);
42    test("abcdefghij", S("abcdefghij"), true);
43    test("abcdefghij", S("abcdefghijklmnopqrst"), false);
44    test("abcdefghijklmnopqrst", S(""), false);
45    test("abcdefghijklmnopqrst", S("abcde"), false);
46    test("abcdefghijklmnopqrst", S("abcdefghij"), false);
47    test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true);
48    }
49}
50
51