1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 // template<class charT, class traits, class Allocator>
13 // constexpr bool operator!=(const basic_string_view<charT,traits> lhs,
14 // const basic_string_view<charT,traits> rhs);
16 #include <string_view>
19 #include "test_macros.h"
20 #include "constexpr_char_traits.hpp"
24 test(S lhs, S rhs, bool x)
26 assert((lhs != rhs) == x);
27 assert((rhs != lhs) == x);
33 typedef std::string_view S;
34 test(S(""), S(""), false);
35 test(S(""), S("abcde"), true);
36 test(S(""), S("abcdefghij"), true);
37 test(S(""), S("abcdefghijklmnopqrst"), true);
38 test(S("abcde"), S(""), true);
39 test(S("abcde"), S("abcde"), false);
40 test(S("abcde"), S("abcdefghij"), true);
41 test(S("abcde"), S("abcdefghijklmnopqrst"), true);
42 test(S("abcdefghij"), S(""), true);
43 test(S("abcdefghij"), S("abcde"), true);
44 test(S("abcdefghij"), S("abcdefghij"), false);
45 test(S("abcdefghij"), S("abcdefghijklmnopqrst"), true);
46 test(S("abcdefghijklmnopqrst"), S(""), true);
47 test(S("abcdefghijklmnopqrst"), S("abcde"), true);
48 test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true);
49 test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false);
54 typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
57 constexpr SV sv3 { "abcde", 5 };
58 static_assert (!( sv1 != sv2), "" );
59 static_assert ( sv1 != sv3, "" );