]>
Commit | Line | Data |
---|---|---|
23cac885 | 1 | // 2001-05-21 Benjamin Kosnik <bkoz@redhat.com> |
53279c10 | 2 | |
23cac885 | 3 | // Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. |
53279c10 JQ |
4 | // |
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) | |
9 | // any later version. | |
10 | ||
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. | |
15 | ||
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 | |
83f51799 | 18 | // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
53279c10 JQ |
19 | // USA. |
20 | ||
23cac885 BK |
21 | // 27.8.1.4 Overridden virtual functions |
22 | ||
0c20e4ec NS |
23 | // { dg-require-fileio "" } |
24 | ||
23cac885 | 25 | #include <fstream> |
53279c10 | 26 | #include <testsuite_hooks.h> |
46c4e5d6 | 27 | #include <testsuite_io.h> |
53279c10 | 28 | |
46c4e5d6 BK |
29 | // @require@ %-*.tst %-*.txt |
30 | // @diff@ %-*.tst %*.txt | |
53279c10 | 31 | |
46c4e5d6 BK |
32 | const char name_01[] = "filebuf_virtuals-1.txt"; // file with data in it |
33 | ||
34 | // Test overloaded virtual functions. | |
35 | void test05() | |
53279c10 JQ |
36 | { |
37 | using namespace std; | |
aecf642c | 38 | using namespace __gnu_test; |
46c4e5d6 BK |
39 | typedef std::filebuf::int_type int_type; |
40 | typedef filebuf::traits_type traits_type; | |
41 | ||
11f10e6b | 42 | bool test __attribute__((unused)) = true; |
46c4e5d6 BK |
43 | int_type c1, c2, c3; |
44 | ||
45 | // int_type sgetc() | |
46 | // if read_cur not avail, return uflow(), else return *read_cur | |
53279c10 | 47 | |
46c4e5d6 BK |
48 | // in |
49 | { | |
50 | constraint_filebuf fb_01; // in | |
51 | fb_01.open(name_01, ios::in); | |
52 | VERIFY( !fb_01.write_position() ); | |
53 | c1 = fb_01.sgetc(); | |
54 | VERIFY( c1 == '/' ); | |
55 | c2 = fb_01.sgetc(); | |
56 | VERIFY( c1 == c2 ); | |
57 | fb_01.sbumpc(); | |
58 | c1 = fb_01.sbumpc(); | |
59 | c2 = fb_01.sgetc(); | |
60 | c3 = fb_01.sgetc(); | |
61 | VERIFY( c1 == '/' ); | |
62 | VERIFY( c2 == ' ' ); | |
63 | VERIFY( c3 == ' ' ); | |
64 | VERIFY( !fb_01.write_position() ); | |
65 | VERIFY( fb_01.read_position() ); | |
66 | } | |
53279c10 JQ |
67 | } |
68 | ||
11f10e6b | 69 | int main() |
53279c10 | 70 | { |
46c4e5d6 | 71 | test05(); |
53279c10 JQ |
72 | return 0; |
73 | } |