Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / libc++ / trunk / test / experimental / string.view / string.view.comparison / opne.string_view.string.pass.cpp
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, basic_string_view<charT,traits> rhs);
14 // template<class charT, class traits, class Allocator>
15 //   bool operator!=(basic_string_view<charT,traits> lhs, const basic_string<charT, traits, Allocator> &rhs);
16
17 #include <experimental/string_view>
18 #include <cassert>
19
20 template <class S>
21 void
22 test(const std::string &lhs, S rhs, bool x)
23 {
24     assert((lhs != rhs) == x);
25     assert((rhs != lhs) == x);
26 }
27
28 int main()
29 {
30     {
31     typedef std::experimental::string_view S;
32     test("", S(""), false);
33     test("", S("abcde"), true);
34     test("", S("abcdefghij"), true);
35     test("", S("abcdefghijklmnopqrst"), true);
36     test("abcde", S(""), true);
37     test("abcde", S("abcde"), false);
38     test("abcde", S("abcdefghij"), true);
39     test("abcde", S("abcdefghijklmnopqrst"), true);
40     test("abcdefghij", S(""), true);
41     test("abcdefghij", S("abcde"), true);
42     test("abcdefghij", S("abcdefghij"), false);
43     test("abcdefghij", S("abcdefghijklmnopqrst"), true);
44     test("abcdefghijklmnopqrst", S(""), true);
45     test("abcdefghijklmnopqrst", S("abcde"), true);
46     test("abcdefghijklmnopqrst", S("abcdefghij"), true);
47     test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false);
48     }
49 }