• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <string>
10 
11 // template<class charT, class traits, class Allocator>
12 //   bool operator!=(const basic_string<charT, traits, Allocator> &lhs, basic_string_view<charT,traits> rhs);
13 // template<class charT, class traits, class Allocator>
14 //   bool operator!=(basic_string_view<charT,traits> lhs, const basic_string<charT, traits, Allocator> &rhs);
15 
16 #include <string_view>
17 #include <string>
18 #include <cassert>
19 
20 #include "test_macros.h"
21 
22 template <class S>
23 void
test(const std::string & lhs,S rhs,bool x)24 test(const std::string &lhs, S rhs, bool x)
25 {
26     assert((lhs != rhs) == x);
27     assert((rhs != lhs) == x);
28 }
29 
main(int,char **)30 int main(int, char**)
31 {
32     {
33     typedef std::string_view S;
34     test("", S(""), false);
35     test("", S("abcde"), true);
36     test("", S("abcdefghij"), true);
37     test("", S("abcdefghijklmnopqrst"), true);
38     test("abcde", S(""), true);
39     test("abcde", S("abcde"), false);
40     test("abcde", S("abcdefghij"), true);
41     test("abcde", S("abcdefghijklmnopqrst"), true);
42     test("abcdefghij", S(""), true);
43     test("abcdefghij", S("abcde"), true);
44     test("abcdefghij", S("abcdefghij"), false);
45     test("abcdefghij", S("abcdefghijklmnopqrst"), true);
46     test("abcdefghijklmnopqrst", S(""), true);
47     test("abcdefghijklmnopqrst", S("abcde"), true);
48     test("abcdefghijklmnopqrst", S("abcdefghij"), true);
49     test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false);
50     }
51 
52   return 0;
53 }
54