1800259c9SMarshall Clow //===----------------------------------------------------------------------===//
2800259c9SMarshall Clow //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6800259c9SMarshall Clow //
7800259c9SMarshall Clow //===----------------------------------------------------------------------===//
831cbe0f2SLouis Dionne // UNSUPPORTED: c++03, c++11, c++14, c++17
9800259c9SMarshall Clow 
10800259c9SMarshall Clow // <string>
11800259c9SMarshall Clow 
12*425620ccSNikolas Klauser // constexpr bool ends_with(charT x) const noexcept;
13800259c9SMarshall Clow 
14800259c9SMarshall Clow #include <string>
15800259c9SMarshall Clow #include <cassert>
16800259c9SMarshall Clow 
17800259c9SMarshall Clow #include "test_macros.h"
18800259c9SMarshall Clow 
test()19*425620ccSNikolas Klauser constexpr bool test() {
20800259c9SMarshall Clow   {
21800259c9SMarshall Clow     typedef std::string S;
22800259c9SMarshall Clow     S  s1 {};
23800259c9SMarshall Clow     S  s2 { "abcde", 5 };
24800259c9SMarshall Clow 
25800259c9SMarshall Clow     ASSERT_NOEXCEPT(s1.ends_with('e'));
26800259c9SMarshall Clow 
27800259c9SMarshall Clow     assert (!s1.ends_with('e'));
28800259c9SMarshall Clow     assert (!s1.ends_with('x'));
29800259c9SMarshall Clow     assert ( s2.ends_with('e'));
30800259c9SMarshall Clow     assert (!s2.ends_with('x'));
31800259c9SMarshall Clow   }
322df59c50SJF Bastien 
33c515b652SNikolas Klauser   return true;
34c515b652SNikolas Klauser }
35c515b652SNikolas Klauser 
main(int,char **)36c515b652SNikolas Klauser int main(int, char**)
37c515b652SNikolas Klauser {
38c515b652SNikolas Klauser   test();
39*425620ccSNikolas Klauser   static_assert(test());
40c515b652SNikolas Klauser 
412df59c50SJF Bastien   return 0;
42800259c9SMarshall Clow }
43