1260684Skaiw// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
2260684Skaiw
3260684Skaiw// Copyright (C) 2003-2015 Free Software Foundation, Inc.
4260684Skaiw//
5260684Skaiw// This file is part of the GNU ISO C++ Library.  This library is free
6260684Skaiw// software; you can redistribute it and/or modify it under the
7260684Skaiw// terms of the GNU General Public License as published by the
8260684Skaiw// Free Software Foundation; either version 3, or (at your option)
9260684Skaiw// any later version.
10260684Skaiw
11260684Skaiw// This library is distributed in the hope that it will be useful,
12260684Skaiw// but WITHOUT ANY WARRANTY; without even the implied warranty of
13260684Skaiw// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14260684Skaiw// GNU General Public License for more details.
15260684Skaiw
16260684Skaiw// You should have received a copy of the GNU General Public License along
17260684Skaiw// with this library; see the file COPYING3.  If not see
18260684Skaiw// <http://www.gnu.org/licenses/>.
19260684Skaiw
20260684Skaiw#include <ext/stdio_sync_filebuf.h>
21260684Skaiw#include <testsuite_hooks.h>
22260684Skaiw
23260684Skaiw// libstdc++/12048
24260684Skaiwvoid test02()
25367466Sdim{
26260684Skaiw  bool test __attribute__((unused)) = true;
27260684Skaiw  const char* name = "cin_unget-1.txt";
28367466Sdim
29260684Skaiw  std::FILE* file = std::fopen(name, "r");
30260684Skaiw  __gnu_cxx::stdio_sync_filebuf<wchar_t> sbuf(file);
31260684Skaiw  std::wint_t c1 = sbuf.sbumpc();
32260684Skaiw  VERIFY( c1 != WEOF );
33260684Skaiw  std::wint_t c2 = sbuf.sungetc();
34260684Skaiw  VERIFY( c2 != WEOF );
35260684Skaiw  std::wint_t c3 = sbuf.sbumpc();
36260684Skaiw  VERIFY( c3 == c1 );
37260684Skaiw
38260684Skaiw  std::fclose(file);
39260684Skaiw}
40260684Skaiw
41260684Skaiwint main ()
42260684Skaiw{
43260684Skaiw  test02();
44260684Skaiw  return 0;
45260684Skaiw}
46260684Skaiw