]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/27_io/basic_istream/ignore/wchar_t/94749.cc
openacc: Don't strip TO_PSET/POINTER for enter/exit data
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 27_io / basic_istream / ignore / wchar_t / 94749.cc
CommitLineData
b32eea9c
JW
1// Copyright (C) 2020 Free Software Foundation, Inc.
2//
3// This file is part of the GNU ISO C++ Library. This library is free
4// software; you can redistribute it and/or modify it under the
5// terms of the GNU General Public License as published by the
6// Free Software Foundation; either version 3, or (at your option)
7// any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13
14// You should have received a copy of the GNU General Public License along
15// with this library; see the file COPYING3. If not see
16// <http://www.gnu.org/licenses/>.
17
18// { dg-do run }
19
20// PR libstdc++/94749
21// basic_istream::ignore(n, c) discards n+1 if next character is equal to c.
22
23#include <sstream>
24#include <testsuite_hooks.h>
25
26typedef wchar_t C;
27
28void
29test01()
30{
31 std::basic_istringstream<C> s(L" + -");
32 s.ignore(1, L'+');
33 VERIFY( s.get() == L'+' );
34 s.ignore(3, L'-');
35 VERIFY( s.get() == L'-' );
36}
37
38void
39test02()
40{
41 std::basic_istringstream<C> s(L".+...-");
42 s.ignore(1, L'+');
43 VERIFY( s.get() == L'+' );
44 s.ignore(3, L'-');
45 VERIFY( s.get() == L'-' );
46}
47
48void
49test03()
50{
51 std::basic_istringstream<C, __gnu_cxx::char_traits<C> > s(L" + -");
52 s.ignore(1, L'+');
53 VERIFY( s.get() == L'+' );
54 s.ignore(3, L'-');
55 VERIFY( s.get() == L'-' );
56}
57
58void
59test04()
60{
61 std::basic_istringstream<C, __gnu_cxx::char_traits<C> > s(L".+...-");
62 s.ignore(1, L'+');
63 VERIFY( s.get() == L'+' );
64 s.ignore(3, L'-');
65 VERIFY( s.get() == L'-' );
66}
67
68
69int
70main()
71{
72 // test01();
73 // test02();
74 test03();
75 test04();
76}