107163879Schristos // { dg-options "-std=gnu++17" }
207163879Schristos 
3*1424dfb3Schristos // Copyright (C) 2013-2020 Free Software Foundation, Inc.
407163879Schristos //
507163879Schristos // This file is part of the GNU ISO C++ Library.  This library is free
607163879Schristos // software; you can redistribute it and/or modify it under the
707163879Schristos // terms of the GNU General Public License as published by the
807163879Schristos // Free Software Foundation; either version 3, or (at your option)
907163879Schristos // any later version.
1007163879Schristos 
1107163879Schristos // This library is distributed in the hope that it will be useful,
1207163879Schristos // but WITHOUT ANY WARRANTY; without even the implied warranty of
1307163879Schristos // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1407163879Schristos // GNU General Public License for more details.
1507163879Schristos 
1607163879Schristos // You should have received a copy of the GNU General Public License along
1707163879Schristos // with this library; see the file COPYING3.  If not see
1807163879Schristos // <http://www.gnu.org/licenses/>.
1907163879Schristos 
2007163879Schristos namespace operations_rfind_3 {
2107163879Schristos 
2207163879Schristos // basic_string_view::find_last_not_of
2307163879Schristos 
24*1424dfb3Schristos static void
test03()2507163879Schristos test03 ()
2607163879Schristos {
2707163879Schristos   typedef gdb::string_view::size_type csize_type;
2807163879Schristos   gdb::string_view::size_type pos;
2907163879Schristos   csize_type npos = gdb::string_view::npos;
3007163879Schristos 
3107163879Schristos   gdb::string_view x;
3207163879Schristos   pos = x.find_last_not_of('X');
3307163879Schristos   VERIFY( pos == npos );
3407163879Schristos   pos = x.find_last_not_of("XYZ");
3507163879Schristos   VERIFY( pos == npos );
3607163879Schristos 
3707163879Schristos   gdb::string_view y("a");
3807163879Schristos   pos = y.find_last_not_of('X');
3907163879Schristos   VERIFY( pos == 0 );
4007163879Schristos   pos = y.find_last_not_of('a');
4107163879Schristos   VERIFY( pos == npos );
4207163879Schristos   pos = y.find_last_not_of("XYZ");
4307163879Schristos   VERIFY( pos == 0 );
4407163879Schristos   pos = y.find_last_not_of("a");
4507163879Schristos   VERIFY( pos == npos );
4607163879Schristos 
4707163879Schristos   gdb::string_view z("ab");
4807163879Schristos   pos = z.find_last_not_of('X');
4907163879Schristos   VERIFY( pos == 1 );
5007163879Schristos   pos = z.find_last_not_of("XYZ");
5107163879Schristos   VERIFY( pos == 1 );
5207163879Schristos   pos = z.find_last_not_of('b');
5307163879Schristos   VERIFY( pos == 0 );
5407163879Schristos   pos = z.find_last_not_of("Xb");
5507163879Schristos   VERIFY( pos == 0 );
5607163879Schristos   pos = z.find_last_not_of("Xa");
5707163879Schristos   VERIFY( pos == 1 );
5807163879Schristos }
59*1424dfb3Schristos 
60*1424dfb3Schristos static int
main()6107163879Schristos main ()
6207163879Schristos {
6307163879Schristos   test03();
6407163879Schristos 
6507163879Schristos   return 0;
6607163879Schristos }
6707163879Schristos 
6807163879Schristos } // namespace operations_rfind_3
69