]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/27_io/basic_istream/get/char/3.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 27_io / basic_istream / get / char / 3.cc
CommitLineData
75a25e3f
PC
1// 2004-11-26 Paolo Carlini <pcarlini@suse.de>
2
99dee823 3// Copyright (C) 2004-2021 Free Software Foundation, Inc.
75a25e3f
PC
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
748086b7 8// Free Software Foundation; either version 3, or (at your option)
75a25e3f
PC
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
748086b7
JJ
17// with this library; see the file COPYING3. If not see
18// <http://www.gnu.org/licenses/>.
75a25e3f
PC
19
20// 27.6.1.3 unformatted input functions
21
22#include <sstream>
23#include <testsuite_hooks.h>
24
25// DR 243. get and getline when sentry reports failure.
26void test01()
27{
28 using namespace std;
75a25e3f
PC
29
30 stringbuf strbuf01;
31 stringbuf strbuf02;
32 istream istr01(&strbuf01);
33 istream istr02(&strbuf02);
34 char buf02[2] = "*" ;
35
36 istr01.peek();
37 VERIFY( istr01.eof() );
38
39 istr01.get(0, 0);
40 VERIFY( istr01.gcount() == 0 );
41 VERIFY( istr01.fail() );
42
43 istr02.peek();
44 VERIFY( istr02.eof() );
45
46 istr02.get(buf02, 1);
47 VERIFY( istr02.gcount() == 0 );
48 VERIFY( istr02.fail() );
49 VERIFY( buf02[0] == char() );
50}
51
52int main()
53{
54 test01();
55 return 0;
56}