3 // Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
4 // Free Software Foundation, Inc.
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)
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.
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/>.
22 // 27.5.2 template class basic_streambuf
26 #include <testsuite_hooks.h>
28 class testbuf : public std::streambuf
33 typedef std::streambuf::traits_type traits_type;
34 typedef std::streambuf::char_type char_type;
36 testbuf(): std::streambuf()
42 bool test __attribute__((unused)) = true;
43 VERIFY( this->eback() == NULL );
44 VERIFY( this->gptr() == NULL );
45 VERIFY( this->egptr() == NULL );
46 VERIFY( this->pbase() == NULL );
47 VERIFY( this->pptr() == NULL );
48 VERIFY( this->epptr() == NULL );
54 { return (this->uflow()); }
57 pub_overflow(int_type __c = traits_type::eof())
58 { return (this->overflow(__c)); }
61 pub_pbackfail(int_type __c)
62 { return (this->pbackfail(__c)); }
65 pub_setg(char* beg, char* cur, char *end)
66 { this->setg(beg, cur, end); }
69 pub_setp(char* beg, char* end)
70 { this->setp(beg, end); }
76 int_type __retval = traits_type::eof();
77 if (this->gptr() < this->egptr())
78 __retval = traits_type::not_eof(0);
85 typedef testbuf::traits_type traits_type;
86 typedef testbuf::int_type int_type;
88 bool test __attribute__((unused)) = true;
90 std::strcpy(lit01, "chicago underground trio/possible cube on delmark");
95 buf01.pub_setg(lit01, lit01, (lit01 + i01));
96 VERIFY( i01 == buf01.in_avail() );
97 int_type intt01 = traits_type::to_int_type('b');
98 VERIFY( traits_type::eof() == buf01.pub_pbackfail(intt01) );
101 VERIFY( traits_type::eof() == buf01.pub_overflow(intt01) );
102 VERIFY( traits_type::eof() == buf01.pub_overflow() );
103 VERIFY( buf01.sgetc() == traits_type::to_int_type(lit01[0]) );