1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
8 // UNSUPPORTED: c++03, c++11, c++14, c++17
12 // constexpr bool ends_with(charT x) const noexcept;
14 #include <string_view>
17 #include "test_macros.h"
18 #include "constexpr_char_traits.h"
23 typedef std::string_view SV
;
25 SV sv2
{ "abcde", 5 };
27 ASSERT_NOEXCEPT(sv1
.ends_with('e'));
29 assert (!sv1
.ends_with('e'));
30 assert (!sv1
.ends_with('x'));
31 assert ( sv2
.ends_with('e'));
32 assert (!sv2
.ends_with('x'));
37 typedef std::basic_string_view
<char, constexpr_char_traits
<char>> SV
;
39 constexpr SV sv2
{ "abcde", 5 };
40 static_assert (!sv1
.ends_with('e'), "" );
41 static_assert (!sv1
.ends_with('x'), "" );
42 static_assert ( sv2
.ends_with('e'), "" );
43 static_assert (!sv2
.ends_with('x'), "" );