This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
teststute\27_io\basic_filebuf\sgetn\char\1-in.cc
- From: Karl Lindstrom <karllindstrom at mac dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Sun, 24 Aug 2008 17:40:05 -0700
- Subject: teststute\27_io\basic_filebuf\sgetn\char\1-in.cc
Hello,
I am porting the libstdc++-v3\testsuite to an embedded environment.
I get a few failures in the 27_io\basic_filebuf\sgetn directory.
In 1-in.cc it fails in the void test05() routine at:
{
constraint_filebuf fb_01;
// Need this since BUFSIZ is only guaranteed >= 255 and we want
// to trigger the same underflow situation everywhere.
fb_01.pubsetbuf(buffer, 8192);
fb_01.open(name_01, ios_base::in);
VERIFY( !fb_01.write_position() );
strmsz_1 = fb_01.in_avail(); // 8261
strmsz_2 = fb_01.sgetn(carray1, 10);
VERIFY( strmsz_2 == 10 );
strmsz_2 = fb_01.in_avail();
VERIFY( strmsz_1 > strmsz_2 );
c1 = fb_01.sgetc();
VERIFY( c1 == 'b' );
strmsz_1 = fb_01.in_avail();
strmsz_2 = fb_01.sgetn(carray2, strmsz_1 + 5);
VERIFY( strmsz_1 == strmsz_2 - 5 ); //
<--------------------------------------Fails here.
c4 = fb_01.sgetc(); // buffer should have underflowed from above.
VERIFY( c4 == 'h' );
strmsz_1 = fb_01.in_avail();
VERIFY( strmsz_1 > 0 );
strmsz_2 = fb_01.sgetn(carray2, strmsz_1 + 5);
VERIFY( strmsz_1 == strmsz_2 ); //at the end of the actual file
VERIFY( !fb_01.write_position() );
VERIFY( !fb_01.read_position() );
}
When I look at the code in the debugger: strmsz_1 and strmsz_2 are
the same value
at that line.
When I look at the definition of sgetn() it looks like that is
correct, since asking for
in_avail() + 5 would only return in_avail() characters.
Do I have the latest test, or is there anything I am missing here?
Thanks.
-Karl