1 // 2004-08-12 Paolo Carlini <pcarlini@suse.de>
3 // Copyright (C) 2004 Free Software Foundation, Inc.
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
8 // Free Software Foundation; either version 2, or (at your option)
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.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING. If not, write to the Free
18 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 // 27.7.1.3 Overridden virtual functions
24 #include <testsuite_hooks.h>
29 bool test
__attribute__((unused
)) = true;
32 typedef stringbuf::int_type int_type
;
33 typedef stringbuf::traits_type traits_type
;
34 typedef stringbuf::pos_type pos_type
;
35 typedef stringbuf::off_type off_type
;
37 stringbuf
strb_01("lara's place", ios_base::in
);
38 pos_type pt_1
= strb_01
.pubseekoff(5, ios_base::cur
, ios_base::in
);
39 int_type c1
= strb_01
.sgetc();
40 VERIFY( c1
!= traits_type::eof() );
41 pos_type pt_2
= strb_01
.pubseekoff(2, ios_base::cur
, ios_base::in
);
42 pos_type pt_3
= strb_01
.pubseekpos(pt_1
, ios_base::in
);
43 int_type c2
= strb_01
.sbumpc();
44 VERIFY( off_type(pt_3
) == off_type(pt_2
) - 2 );
47 stringbuf
strb_02("-", ios_base::out
);
48 pos_type pt_4
= strb_02
.pubseekoff(0, ios_base::cur
, ios_base::out
);
49 strb_02
.sputn("red", 3);
50 pos_type pt_5
= strb_02
.pubseekoff(-3, ios_base::cur
, ios_base::out
);
51 strb_02
.pubseekpos(pt_5
, ios_base::out
);
52 VERIFY( off_type(pt_5
) == off_type(pt_4
) );
53 strb_02
.sputn("blu", 3);
54 VERIFY( strb_02
.str() == "blu" );