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