Commit e3acb1187658dc7732d821c8a8383b164647fb57

Add comments in regression test for bug #2881622 (fixed)
  
1// -*- C++ -*- Time-stamp: <09/10/22 23:31:10 ptr>
1// -*- C++ -*- Time-stamp: <09/10/23 08:28:43 ptr>
22
33/*
44 * Copyright (c) 2004-2008
304304int EXAM_IMPL(fstream_test::rewind)
305305{
306306#ifdef __unix__
307 /* Bug ID 2881622: write fail after failed read-and-recovery */
307308 const char fname[] = "/tmp/stlport.test";
308309 {
310 // Create empty file for read and write
309311 fstream f( fname, ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary );
310312
311313 int n = 0;
315315 EXAM_CHECK( f.is_open() );
316316 EXAM_CHECK( f.good() );
317317
318 // write to this file
318319 f.write( (const char*)&n, sizeof(int) );
319320 EXAM_CHECK( f.good() );
321 // rewind 'get' pointer to end
320322 f.seekg( sizeof(int), ios_base::beg );
321323 EXAM_CHECK( f.good() );
324 // try to read
322325 f.read( (char *)&n, sizeof(int) );
326 // read operation fail, as expected
323327 EXAM_CHECK( f.fail() );
328 // clear stream state
324329 f.clear();
325330 EXAM_CHECK( f.good() );
326331 n = 0;
332 // continue append to EOF
327333 f.write( (const char*)&n, sizeof(int) );
334 // if bug #2881622 present, operation fail
328335 EXAM_CHECK( f.good() );
329336 }
337 // check that we indeed wrote what expected:
330338 {
331339 ifstream f( fname );
332340 char c = -1;