1// 981208 bkoz test functionality of basic_stringbuf for char_type == char
2
3// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2009
4// Free Software Foundation, Inc.
5//
6// This file is part of the GNU ISO C++ Library.  This library is free
7// software; you can redistribute it and/or modify it under the
8// terms of the GNU General Public License as published by the
9// Free Software Foundation; either version 3, or (at your option)
10// any later version.
11
12// This library is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15// GNU General Public License for more details.
16
17// You should have received a copy of the GNU General Public License along
18// with this library; see the file COPYING3.  If not see
19// <http://www.gnu.org/licenses/>.
20
21#include <sstream>
22#include <testsuite_hooks.h>
23
24std::string str_01("mykonos. . . or what?");
25std::string str_02("paris, or sainte-maxime?");
26std::string str_03;
27std::stringbuf strb_01(str_01);
28std::stringbuf strb_02(str_02, std::ios_base::in);
29std::stringbuf strb_03(str_03, std::ios_base::out);
30
31// test overloaded virtual functions
32void test04()
33{
34  bool test __attribute__((unused)) = true;
35  std::streamoff  		strmof_1(-1), strmof_2;
36
37  // GET
38  // int in_avail()
39  strmof_1 = strb_01.in_avail();
40  strmof_2 = strb_02.in_avail();
41  VERIFY( strmof_1 != strmof_2 );
42  VERIFY( strmof_1 == static_cast<std::streamoff>(str_01.length()) );
43  VERIFY( strmof_2 == static_cast<std::streamoff>(str_02.length()) );
44  strmof_1 = strb_03.in_avail();
45  // zero cuz write-only, or eof() to match basic_filebuf
46  VERIFY( strmof_1 == -1 );
47}
48
49int main()
50{
51  test04();
52  return 0;
53}
54
55
56
57// more candy!!!
58