]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/21_strings/basic_string/operations/starts_with/char.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 21_strings / basic_string / operations / starts_with / char.cc
CommitLineData
d8c446a1 1// { dg-do run { target c++20 } }
5bd624fb 2
a945c346 3// Copyright (C) 2018-2024 Free Software Foundation, Inc.
5bd624fb
ESR
4//
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
8// Free Software Foundation; either version 3, or (at your option)
9// any later version.
10
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// You should have received a copy of the GNU General Public License along
17// with this library; see the file COPYING3. If not see
18// <http://www.gnu.org/licenses/>.
19
20// basic_string begins_with
21
5f932c9f 22#include <testsuite_string.h>
5bd624fb
ESR
23#include <testsuite_hooks.h>
24
25void
26test01()
27{
28 const char cstr_dir[] = "slugs/";
29 const std::string_view sv_dir("slugs/");
30 const char cstr_dir2[] = "worms/";
31 const std::string_view sv_dir2("worms/");
32
5f932c9f 33 const __gnu_test::string s_test("slugs/slimy.jpg");
5bd624fb
ESR
34
35 const auto cstr_in_slugs = s_test.starts_with(cstr_dir);
36 VERIFY( cstr_in_slugs );
37 const auto sv_in_slugs = s_test.starts_with(sv_dir);
38 VERIFY( sv_in_slugs );
39 const auto char_s = s_test.starts_with('s');
40 VERIFY( char_s );
41
42 const auto cstr_in_worms = s_test.starts_with(cstr_dir2);
43 VERIFY( !cstr_in_worms );
44 const auto sv_in_worms = s_test.starts_with(sv_dir2);
45 VERIFY( !sv_in_worms );
46 const auto char_w = s_test.starts_with('w');
47 VERIFY( !char_w );
48}
49
50int
51main()
f004d6d9 52{
5bd624fb
ESR
53 test01();
54 return 0;
55}