]> gcc.gnu.org Git - gcc.git/blob - libstdc++-v3/testsuite/27_io/filebuf_virtuals.cc
3090f315912d88a2067bfd2b7c666331ca8aab26
[gcc.git] / libstdc++-v3 / testsuite / 27_io / filebuf_virtuals.cc
1 // 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
2
3 // Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
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
18 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 // USA.
20
21 // 27.8.1.4 Overridden virtual functions
22
23 #include <fstream>
24 #include <locale>
25 #include <testsuite_hooks.h>
26
27 // @require@ %-*.tst %-*.txt
28 // @diff@ %-*.tst %*.txt
29
30 void test01()
31 {
32 using namespace std;
33
34 bool test = true;
35 char buf[512];
36 const char* strlit = "how to tell a story and other essays: mark twain";
37 const size_t strlitsize = std::strlen(strlit);
38 filebuf fbuf01;
39
40 fbuf01.pubsetbuf(buf, 512);
41 fbuf01.sputn(strlit, strlitsize);
42 VERIFY( std::strncmp(strlit, buf, strlitsize) != 0 );
43 }
44
45 void test02()
46 {
47 using namespace std;
48
49 bool test = true;
50 char buf[512];
51 const char* strlit = "how to tell a story and other essays: mark twain";
52 const size_t strlitsize = std::strlen(strlit);
53 filebuf fbuf01;
54 fbuf01.open("tmp", ios_base::out);
55
56 fbuf01.pubsetbuf(buf, strlitsize);
57 fbuf01.sputn(strlit, strlitsize);
58 VERIFY( std::strncmp(strlit, buf, strlitsize) == 0 );
59 }
60
61
62 // NB: This test assumes that _M_buf_size == 40, and not the usual
63 // buffer_size length of BUFSIZ (8192), so that overflow/underflow can be
64 // simulated a bit more readily.
65 // NRB (Nota Really Bene): setting it to 40 breaks the test, as intended.
66 const int buffer_size = 8192;
67 //const int buffer_size = 40;
68
69 const char carray_01[] = "santa cruz or sandiego?";
70 const char carray_02[] = "memphis, new orleans, and savanah";
71 const char name_01[] = "filebuf_virtuals-1.txt"; // file with data in it
72 const char name_02[] = "filebuf_virtuals-2.txt"; // empty file, need to create
73 const char name_03[] = "filebuf_virtuals-3.txt"; // empty file, need to create
74
75
76 class derived_filebuf: public std::filebuf
77 {
78 public:
79 void
80 set_size(int_type __size) { _M_buf_size_opt = __size; }
81 };
82
83 derived_filebuf fb_01; // in
84 derived_filebuf fb_02; // out
85 derived_filebuf fb_03; // in | out
86
87
88 // Initialize filebufs to be the same size regardless of platform.
89 void test03()
90 {
91 fb_01.set_size(buffer_size);
92 fb_02.set_size(buffer_size);
93 fb_03.set_size(buffer_size);
94 }
95
96
97 // Test the filebuf/stringbuf locale settings.
98 void test04()
99 {
100 std::locale loc_tmp;
101 loc_tmp = fb_01.getloc();
102 fb_01.pubimbue(loc_tmp); //This should initialize _M_init to true
103 fb_01.getloc(); //This should just return _M_locale
104 }
105
106 // Test overloaded virtual functions.
107 void test05()
108 {
109 typedef std::filebuf::int_type int_type;
110 typedef std::filebuf::traits_type traits_type;
111 typedef std::filebuf::pos_type pos_type;
112 typedef std::filebuf::off_type off_type;
113 typedef size_t size_type;
114
115 bool test = true;
116 std::filebuf f_tmp;
117 std::streamsize strmsz_1, strmsz_2;
118 std::streamoff strmof_1, strmof_2;
119 int i = 0, j = 0, k = 0;
120
121 // GET
122 // int showmanyc()
123 // returns an estimate of the numbers of chars in the seq, or -1.
124 // if __retval > 0, then calls to underflow won't return
125 // traits_type::eof() till at least __retval chars.
126 // if __retval == -1, then calls to underflow or uflow will fail.
127 // NB overriding def if it can determine more chars can be read from
128 // the input sequence.
129
130 // int in_avail()
131 // if a read position is available, return _M_in_end - _M_in_cur.
132 // else return showmanyc.
133 strmof_1 = fb_01.in_avail();
134 strmof_2 = fb_02.in_avail();
135 VERIFY( strmof_1 == -1 );
136 VERIFY( strmof_1 == strmof_2 ); //fail because not open
137 strmof_1 = fb_03.in_avail();
138 VERIFY( strmof_1 == strmof_2 );
139 fb_01.open(name_01, std::ios_base::in);
140 fb_02.open(name_02, std::ios_base::out | std::ios_base::trunc);
141 fb_03.open(name_03, std::ios_base::out | std::ios_base::in | std::ios_base::trunc);
142 strmof_1 = fb_01.in_avail();
143 strmof_2 = fb_02.in_avail();
144 VERIFY( strmof_1 != strmof_2 );
145 VERIFY( strmof_1 >= 0 );
146 VERIFY( strmof_2 == -1 ); // empty file
147 strmof_1 = fb_03.in_avail();
148 VERIFY( strmof_1 == 0 ); // empty file
149
150 // int_type sbumpc()
151 // if read_cur not avail returns uflow(), else return *read_cur & increment
152 int_type c1 = fb_01.sbumpc();
153 int_type c2 = fb_02.sbumpc();
154 VERIFY( c1 != c2 );
155 VERIFY( c1 == '/' );
156 VERIFY( c2 == -1 );
157 int_type c3 = fb_01.sbumpc();
158 int_type c4 = fb_02.sbumpc();
159 VERIFY( c3 != c4 );
160 VERIFY( c1 == c3 ); // fluke, both happen to be '/'
161 VERIFY( c2 == c4 );
162 int_type c5 = fb_03.sbumpc();
163 VERIFY( c5 == traits_type::eof() );
164 // XXX should do some kind of test to make sure that internal
165 // buffers point ot the same thing, to check consistancy.
166
167 // int_type sgetc()
168 // if read_cur not avail, return uflow(), else return *read_cur
169 int_type c6 = fb_01.sgetc();
170 int_type c7 = fb_02.sgetc();
171 VERIFY( c6 != c3 );
172 VERIFY( c7 == c4 ); // both -1
173 int_type c8 = fb_01.sgetc();
174 int_type c9 = fb_02.sgetc();
175 VERIFY( c6 == c8 );
176 VERIFY( c7 == c9 );
177 c5 = fb_03.sgetc();
178 VERIFY( c5 == traits_type::eof() );
179
180 // int_type snextc()
181 // calls sbumpc and if sbumpc != eof, return sgetc
182 c6 = fb_01.snextc();
183 c7 = fb_02.snextc();
184 VERIFY( c6 != c8 );
185 VERIFY( c7 == c9 ); // -1
186 VERIFY( c6 == '9' );
187 c6 = fb_01.snextc();
188 c7 = fb_02.snextc();
189 VERIFY( c6 != c8 );
190 VERIFY( c7 == c9 ); // -1
191 VERIFY( c6 == '9' );
192 c5 = fb_03.snextc();
193 VERIFY( c5 == traits_type::eof() );
194
195 // streamsize sgetn(char_type *s, streamsize n)
196 // streamsize xsgetn(char_type *s, streamsize n)
197 // assign up to n chars to s from input sequence, indexing in_cur as
198 // approp and returning the number of chars assigned
199 strmsz_1 = fb_01.in_avail();
200 strmsz_2 = fb_02.in_avail();
201 test = strmsz_1 != strmsz_2;
202 char carray1[13] = "";
203 strmsz_1 = fb_01.sgetn(carray1, 10);
204 char carray2[buffer_size] = "";
205 strmsz_2 = fb_02.sgetn(carray2, 10);
206 VERIFY( strmsz_1 != strmsz_2 );
207 VERIFY( strmsz_1 == 10 );
208 VERIFY( strmsz_2 == 0 );
209 c1 = fb_01.sgetc();
210 c2 = fb_02.sgetc();
211 VERIFY( c1 == '\n' );
212 VERIFY( c7 == c2 ); // n != i
213 strmsz_1 = fb_03.sgetn(carray1, 10);
214 VERIFY( !strmsz_1 ); //zero
215 strmsz_1 = fb_01.in_avail();
216 strmsz_2 = fb_01.sgetn(carray2, strmsz_1 + 5);
217 VERIFY( strmsz_1 == strmsz_2 - 5 );
218 c4 = fb_01.sgetc(); // buffer should have underflowed from above.
219 VERIFY( c4 == 'i' );
220 strmsz_1 = fb_01.in_avail();
221 VERIFY( strmsz_1 > 0 );
222 strmsz_2 = fb_01.sgetn(carray2, strmsz_1 + 5);
223 VERIFY( strmsz_1 == strmsz_2 ); //at the end of the actual file
224 strmsz_1 = fb_02.in_avail();
225 strmsz_2 = fb_02.sgetn(carray2, strmsz_1 + 5);
226 VERIFY( strmsz_1 == -1 );
227 VERIFY( strmsz_2 == 0 );
228 c4 = fb_02.sgetc(); // should be EOF
229 VERIFY( c4 == traits_type::eof() );
230
231 // PUT
232 // int_type sputc(char_type c)
233 // if out_cur not avail, return overflow(traits_type::to_int_type(c))
234 // else, stores c at out_cur,
235 // increments out_cur, and returns c as int_type
236 // strmsz_1 = fb_03.in_avail(); // XXX valid for in|out??
237 c1 = fb_02.sputc('a');
238 c2 = fb_03.sputc('b');
239 VERIFY( c1 != c2 );
240 c1 = fb_02.sputc('c');
241 c2 = fb_03.sputc('d');
242 VERIFY( c1 != c2 );
243 // strmsz_2 = fb_03.in_avail();
244 // VERIFY( strmsz_1 != strmsz_2 );
245 for (int i = 50; i <= 90; ++i)
246 c2 = fb_02.sputc(char(i));
247 // 27filebuf-2.txt == ac23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWX
248 // fb_02._M_out_cur = '2'
249 strmsz_1 = fb_03.in_avail();
250 for (int i = 50; i <= 90; ++i)
251 c2 = fb_03.sputc(char(i));
252 strmsz_2 = fb_03.in_avail();
253 // VERIFY( strmsz_1 != strmsz_2 );
254 // VERIFY( strmsz_1 > 0 );
255 // VERIFY( strmsz_2 > 0 );
256 // 27filebuf-2.txt == bd23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWX
257 // fb_02._M_out_cur = '2'
258 c3 = fb_01.sputc('a'); // should be EOF because this is read-only
259 VERIFY( c3 == traits_type::eof() );
260
261 // streamsize sputn(const char_typs* s, streamsize n)
262 // write up to n chars to out_cur from s, returning number assigned
263 // NB *sputn will happily put '\0' into your stream if you give it a chance*
264 strmsz_1 = fb_03.sputn("racadabras", 10);//"abracadabras or what?"
265 VERIFY( strmsz_1 == 10 );
266 strmsz_2 = fb_03.sputn(", i wanna reach out and", 10);
267 VERIFY( strmsz_2 == 10 );
268 VERIFY( strmsz_1 == strmsz_2 );
269 // fb_03._M_out_beg = "YZracadabras, i wanna FGHIJKLMNOPQRSTUVW"
270 // fb_03._M_out_cur = "FGHIJKLMNOPQRSTUVW"
271 strmsz_1 = fb_02.sputn("racadabras", 10);
272 VERIFY( strmsz_1 == 10 );
273 // fb_02._M_out_beg = "YZracadabras<=>?@ABCDEFGHIJKLMNOPQRSTUVW"
274 // fb_02._M_out_cur = "<=>?@ABCDEFGHIJKLMNOPQRSTUVW"
275 strmsz_1 = fb_01.sputn("racadabra", 10);
276 VERIFY( strmsz_1 == 0 );
277
278 // PUTBACK
279 // int_type pbfail(int_type c)
280 // called when gptr() null, gptr() == eback(), or traits::eq(*gptr, c) false
281 // "pending sequence" is:
282 // 1) everything as defined in underflow
283 // 2) + if (traits::eq_int_type(c, traits::eof()), then input
284 // sequence is backed up one char before the pending sequence is
285 // determined.
286 // 3) + if (not 2) then c is prepended. Left unspecified is
287 // whether the input sequence is backedup or modified in any way
288 // returns traits::eof() for failure, unspecified other value for success
289
290 // int_type sputbackc(char_type c)
291 // if in_cur not avail || ! traits::eq(c, gptr() [-1]), return pbfail
292 // otherwise decrements in_cur and returns *gptr()
293 c1 = fb_03.sgetc(); // -1
294 c2 = fb_03.sputbackc('z');
295 strmsz_2 = fb_03.in_avail();
296 c3 = fb_03.sgetc();
297 VERIFY( c3 == c2 );
298 VERIFY( c1 != c3 );
299 VERIFY( 1 == strmsz_2 );
300 //test for _in_cur == _in_beg
301 // fb_03._M_out_beg = "bd23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZracada" etc
302 fb_03.pubseekoff(10, std::ios_base::beg,
303 std::ios_base::in | std::ios_base::out);
304 fb_03.sputc('m');
305 strmsz_1 = fb_03.in_avail();
306 c1 = fb_03.sgetc();
307 fb_03.snextc();
308 c2 = fb_03.sputbackc('z');
309 strmsz_2 = fb_03.in_avail();
310 c3 = fb_03.sgetc();
311 VERIFY( c1 != c2 );
312 VERIFY( c3 == c2 );
313 VERIFY( c1 != c3 );
314 VERIFY( c2 == 'z' );
315 // VERIFY( strmsz_1 == strmsz_2 );
316 // test for replacing char with identical one
317 fb_03.snextc();
318 fb_03.sputc('u');
319 fb_03.sputc('v');
320 fb_03.sputc('a');
321 strmsz_1 = fb_03.in_avail();
322 c2 = fb_03.sputbackc('a');
323 strmsz_2 = fb_03.in_avail();
324 c3 = fb_03.sgetc();
325 VERIFY( c3 == c2 );
326 VERIFY( strmsz_1 + 1 == strmsz_2 );
327 //test for ios_base::out
328 c1 = fb_02.sgetc(); // undefined
329 c2 = fb_02.sputbackc('a');
330 VERIFY( c1 == c2 );
331 VERIFY( c1 == -1 );
332
333 // int_type sungetc()
334 // if in_cur not avail, return pbackfail(), else decrement and
335 // return to_int_type(*gptr())
336 // fb_03._M_out_beg = "uvaacadabras, i wannaZ[\\]^_`abcdefghijkl"
337 // fb_03._M_out_cur = "aacadabras, i wannaZ[\\]^_`abcdefghijkl"
338 strmsz_1 = fb_03.in_avail();
339 c2 = fb_03.sungetc(); // delete the 'a'
340 strmsz_2 = fb_03.in_avail();
341 VERIFY( c2 == 'v' ); // VERIFY( c2 != traits_type::eof() );
342 VERIFY( strmsz_1 + 1 == strmsz_2 );
343 //test for _in_cur == _in_beg
344 for (int i = 50; i < 32 + 29; ++i)
345 fb_02.sputc(char(i));
346 fb_02.pubseekoff(0, std::ios_base::beg, std::ios_base::out);
347 c1 = fb_02.sgetc();
348 strmsz_1 = fb_02.in_avail();
349 c2 = fb_02.sungetc();
350 c3 = fb_02.sgetc();
351 strmsz_2 = fb_02.in_avail();
352 VERIFY( c1 == c2 );
353 VERIFY( c2 == c3 );
354 VERIFY( c1 == traits_type::eof() );
355 VERIFY( strmsz_1 == strmsz_2 );
356 //test for _in_cur == _in_end
357 fb_03.pubseekoff(0, std::ios_base::end);
358 strmsz_1 = fb_03.in_avail(); // -1 cuz at the end
359 c1 = fb_03.sgetc();
360 c2 = fb_03.sungetc();
361 strmsz_2 = fb_03.in_avail(); // 1
362 c3 = fb_03.sgetc();
363 VERIFY( c1 != c2 );
364 // VERIFY( c2 == c3 || c2 == traits_type::not_eof(int(c3)) );
365 VERIFY( strmsz_2 != strmsz_1 );
366 VERIFY( strmsz_2 == 1 );
367 //test for ios_base::out
368
369 // BUFFER MANAGEMENT & POSITIONING
370 // int sync()
371 // if a put area exists, overflow.
372 // if a get area exists, do something undefined. (like, nothing)
373 strmsz_1 = fb_01.in_avail();
374 fb_01.pubsync();
375 strmsz_2 = fb_01.in_avail();
376 VERIFY( strmsz_2 == strmsz_1 );
377 strmsz_1 = fb_02.in_avail();
378 fb_02.pubsync();
379 // 27filebuf-2.txt == 53 bytes after this.
380 strmsz_2 = fb_02.in_avail();
381 VERIFY( strmsz_2 == -1 );
382 VERIFY( strmsz_2 == strmsz_1 );
383 strmsz_1 = fb_03.in_avail();
384 fb_03.pubsync();
385 // 27filebuf-3.txt
386 // bd23456789mzuva?@ABCDEFGHIJKLMNOPQRSTUVWXYZracadabras, i wannaz
387 // 63 bytes.
388 strmsz_2 = fb_03.in_avail();
389 VERIFY( strmsz_1 == 1 );
390 // VERIFY( strmsz_2 == 1 );
391
392 // setbuf
393 // pubsetbuf(char_type* s, streamsize n)
394 fb_01.pubsetbuf(0,0);
395 fb_02.pubsetbuf(0,0);
396 fb_03.pubsetbuf(0,0);
397 // Need to test unbuffered output, which means calling this on some
398 // things that have just been opened.
399
400
401 // seekoff
402 // pubseekoff(off_type off, ios_base::seekdir way, ios_base::openmode which)
403 // alters the stream position to off
404 pos_type pt_1(off_type(-1));
405 pos_type pt_2(off_type(0));
406 off_type off_1 = 0;
407 off_type off_2 = 0;
408 //IN|OUT
409 // 27filebuf-3.txt = bd23456789:;<=>?...
410 //beg
411 strmsz_1 = fb_03.in_avail();
412 pt_1 = fb_03.pubseekoff(2, std::ios_base::beg);
413 strmsz_2 = fb_03.in_avail();
414 off_1 = pt_1;
415 VERIFY( off_1 > 0 );
416 c1 = fb_03.snextc(); //current in pointer +1
417 VERIFY( c1 == '3' );
418 c2 = fb_03.sputc('\n'); //current in pointer +1
419 c3 = fb_03.sgetc();
420 VERIFY( c2 != c3 );
421 VERIFY( c3 == '4' );
422 fb_03.pubsync();
423 c1 = fb_03.sgetc();
424 VERIFY( c1 == c3 );
425 //cur
426 // 27filebuf-3.txt = bd2\n456789:;<=>?...
427 pt_2 = fb_03.pubseekoff(2, std::ios_base::cur);
428 off_2 = pt_2;
429 VERIFY( (off_2 == (off_1 + 2 + 1 + 1)) );
430 c1 = fb_03.snextc(); //current in pointer +1
431 VERIFY( c1 == '7' );
432 c2 = fb_03.sputc('x'); //test current out pointer
433 c3 = fb_03.sputc('\n');
434 c1 = fb_03.sgetc();
435 fb_03.pubsync();
436 c3 = fb_03.sgetc();
437 VERIFY( c1 == c3 );
438 //end
439 // 27filebuf-3.txt = "bd2\n456x\n9"
440 pt_2 = fb_03.pubseekoff(0, std::ios_base::end,
441 std::ios_base::in|std::ios_base::out);
442 off_1 = pt_2;
443 VERIFY( off_1 > off_2 ); //weak, but don't know exactly where it ends
444 c3 = fb_03.sputc('\n');
445 strmsz_1 = fb_03.sputn("because because because. . .", 28);
446 VERIFY( strmsz_1 == 28 );
447 c1 = fb_03.sungetc();
448 // Defect? retval of sungetc is not necessarily the character ungotten.
449 // So re-get it.
450 c1 = fb_03.sgetc();
451 fb_03.pubsync();
452 c3 = fb_03.sgetc();
453 VERIFY( c1 == c3 );
454 // IN
455 // OUT
456
457
458 // seekpos
459 // pubseekpos(pos_type sp, ios_base::openmode)
460 // alters the stream position to sp
461 //IN|OUT
462 //beg
463 pt_1 = fb_03.pubseekoff(78, std::ios_base::beg);
464 off_1 = pt_1;
465 VERIFY( off_1 > 0 );
466 c1 = fb_03.snextc(); //current in pointer +1
467 VERIFY( c1 == ' ' );
468 c2 = fb_03.sputc('\n'); //test current out pointer
469 c3 = fb_03.sgetc();
470 fb_03.pubsync(); //resets pointers
471 pt_2 = fb_03.pubseekpos(pt_1);
472 off_2 = pt_2;
473 VERIFY( off_1 == off_2 );
474 c3 = fb_03.snextc(); //current in pointer +1
475 VERIFY( c2 == c3 );
476 pt_1 = fb_03.pubseekoff(0, std::ios_base::end);
477 off_1 = pt_1;
478 VERIFY( off_1 > off_2 );
479 fb_03.sputn("\nof the wonderful things he does!!\nok", 37);
480 fb_03.pubsync();
481
482 // IN
483 // OUT
484
485 // VIRTUALS (indirectly tested)
486 // underflow
487 // if read position avail, returns *gptr()
488
489 // pbackfail(int_type c)
490 // put c back into input sequence
491
492 // overflow
493 // appends c to output seq
494
495 // NB Have to close these suckers. . .
496 // filebuf_type* close()
497 fb_01.close();
498 fb_02.close();
499 fb_03.close();
500 VERIFY( !fb_01.is_open() );
501 VERIFY( !fb_02.is_open() );
502 VERIFY( !fb_03.is_open() );
503 }
504
505 void test06()
506 {
507 using namespace std;
508 typedef istream::int_type int_type;
509
510 bool test = true;
511 ifstream ifs(name_02);
512 char buffer[] = "xxxxxxxxxx";
513 int_type len1 = ifs.rdbuf()->sgetn(buffer, sizeof(buffer));
514 VERIFY( len1 == sizeof(buffer) );
515 VERIFY( buffer[0] == 'a' );
516 }
517
518 // libstdc++/9322
519 void test07()
520 {
521 using std::locale;
522 bool test = true;
523
524 locale loc;
525 std::filebuf ob;
526 VERIFY( ob.getloc() == loc );
527
528 locale::global(locale("en_US"));
529 VERIFY( ob.getloc() == loc );
530
531 locale loc_de ("de_DE");
532 locale ret = ob.pubimbue(loc_de);
533 VERIFY( ob.getloc() == loc_de );
534 VERIFY( ret == loc );
535
536 locale::global(loc);
537 VERIFY( ob.getloc() == loc_de );
538 }
539
540 class MyTraits : public std::char_traits<char>
541 {
542 public:
543 static bool eq(char c1, char c2)
544 {
545 VERIFY( c1 != 'X' );
546 VERIFY( c2 != 'X' );
547 return std::char_traits<char>::eq(c1, c2);
548 }
549 };
550
551 class MyBuf : public std::basic_streambuf<char, MyTraits>
552 {
553 char buffer[8];
554
555 public:
556 MyBuf()
557 {
558 std::memset(buffer, 'X', sizeof(buffer));
559 std::memset(buffer + 2, 'f', 4);
560 setg(buffer + 2, buffer + 2, buffer + 6);
561 }
562 };
563
564 // libstdc++/9538
565 void test08()
566 {
567 bool test = true;
568
569 MyBuf mb;
570 mb.sputbackc('a');
571 }
572
573 // libstdc++/9439, libstdc++/9425
574 void test09()
575 {
576 using namespace std;
577 bool test = true;
578
579 filebuf fbuf;
580 fbuf.open(name_01, ios_base::in);
581 filebuf::int_type r = fbuf.sputbackc('a');
582 fbuf.close();
583
584 VERIFY( r == filebuf::traits_type::eof() );
585 }
586
587 main()
588 {
589 test01();
590 test02();
591
592 test03();
593 test04();
594 test05();
595 test06();
596
597 test07();
598 test08();
599 test09();
600 return 0;
601 }
This page took 0.066663 seconds and 5 git commands to generate.