4c620c398e
2003-09-03 Petur Runolfsson <peturr02@ru.is> PR libstdc++/12048 * include/ext/stdio_sync_filebuf.h (stdio_sync_filebuf::_M_unget_buf): Declare it. (stdio_sync_filebuf::stdio_sync_filebuf): Initialize _M_unget_buf. (stdio_sync_filebuf::uflow): Store the returned character in _M_unget_buf. (stdio_sync_filebuf::pbackfail): If argument is eof(), pass _M_unget_buf to syncungetc(). Set _M_unget_buf to eof(). (stdio_sync_filebuf<char>::xsgetn): Store last read character in _M_unget_buf, if any, else eof(). (stdio_sync_filebuf<wchar_t>::xsgetn: Store last read character in _M_unget_buf, if any, else eof(). * testsuite/27_io/objects/char/12048.cc: Rename to... * testsuite/27_io/objects/char/12048-1.cc: ...this. * testsuite/27_io/objects/char/12048-2.cc: New test. * testsuite/27_io/objects/char/12048-3.cc: New test. * testsuite/27_io/objects/char/12048-4.cc: New test. * testsuite/27_io/objects/char/12048-5.cc: New test. XFAIL. * testsuite/27_io/objects/wchar_t/12048-1.cc: New test. * testsuite/27_io/objects/wchar_t/12048-2.cc: New test. * testsuite/27_io/objects/wchar_t/12048-3.cc: New test. * testsuite/27_io/objects/wchar_t/12048-4.cc: New test. * testsuite/27_io/objects/wchar_t/12048-5.cc: New test. XFAIL. * testsuite/ext/stdio_sync_filebuf_char.cc (test02, test03, test04, test05): New tests. * testsuite/ext/stdio_sync_filebuf_wchar_t.cc (test02, test03, test04, test05): New tests. From-SVN: r71027
40 lines
1.2 KiB
C++
40 lines
1.2 KiB
C++
// Copyright (C) 2003 Free Software Foundation, Inc.
|
|
//
|
|
// This file is part of the GNU ISO C++ Library. This library is free
|
|
// software; you can redistribute it and/or modify it under the
|
|
// terms of the GNU General Public License as published by the
|
|
// Free Software Foundation; either version 2, or (at your option)
|
|
// any later version.
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
|
|
// You should have received a copy of the GNU General Public License along
|
|
// with this library; see the file COPYING. If not, write to the Free
|
|
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
|
// USA.
|
|
|
|
#include <iostream>
|
|
#include <testsuite_hooks.h>
|
|
|
|
void
|
|
test01()
|
|
{
|
|
std::freopen("cin_unget-1.txt", "r", stdin);
|
|
|
|
char buf[2];
|
|
VERIFY( std::cin.rdbuf()->sgetn(buf, 2) == 2 );
|
|
int c1 = std::cin.rdbuf()->sungetc();
|
|
int c2 = std::cin.rdbuf()->sbumpc();
|
|
VERIFY( c1 == std::char_traits<char>::to_int_type(buf[1]) );
|
|
VERIFY( c2 == c1 );
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
test01();
|
|
return 0;
|
|
}
|