You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Farid Zaripov <Fa...@kyiv.vdiweb.com> on 2006/07/11 09:50:50 UTC

RE: test for lib.string.io

> -----Original Message-----
> From: Martin Sebor [mailto:sebor@roguewave.com] 
> Sent: Friday, June 30, 2006 1:25 AM
> To: stdcxx-dev@incubator.apache.org
> Subject: Re: test for lib.string.io

> Thanks for pointing it out! I think I might go ahead and 
> commit these changes sometime over the weekend.

  Martin, the 21.string.io test still generates rw_asserts due to opened
issues 205 and 206.

  What about these issues?

Farid.

Re: test for lib.string.io

Posted by Martin Sebor <se...@roguewave.com>.
Farid Zaripov wrote:
>>-----Original Message-----
>>From: Martin Sebor [mailto:sebor@roguewave.com] 
>>Sent: Friday, June 30, 2006 1:25 AM
>>To: stdcxx-dev@incubator.apache.org
>>Subject: Re: test for lib.string.io
> 
> 
>>Thanks for pointing it out! I think I might go ahead and 
>>commit these changes sometime over the weekend.
> 
> 
>   Martin, the 21.string.io test still generates rw_asserts due to opened
> issues 205 and 206.
> 
>   What about these issues?

I committed the patch below. While the new code is guarded with
a config macro (which is not #defined unless extensions are turned
off) I'm beginning to think we might as well enable the new code
unconditionally since the behavior currently required by the standard
is quite inconsistent (see below).

http://svn.apache.org/viewvc?rev=420970&view=rev

With the patch applied I get 120 failed assertions out of the io
test, all of them on lines 872 through 886. They all look like
they are due to the test expecting failbit for insertions into
the stream buffer that fail and the library setting badbit. I
think the library does the right thing and the standard needs
to be fixed to say that operator<<(ostream&, string) a) is
a Formatted Output Function and b) should behave according to
the requirements on such functions and thus should set badbit
and not failbit when it fails to produce the expected output.

Martin

Functions that are required to set badbit:
   ios::iword(int): on failure
   ios::pword(int): on failure
   ios::clear(iostate): rdbuf() == 0
   Formatted/Unformatted Input Functions: on exception from streambuf
   Formatted/Unformatted Output Functions: on exception from streambuf
U istream::putback(char): rdbuf()->sputbackc() returns EOF
U istream::unget(): rdbuf()->sungetc() returns EOF
U istream::sync(): rdbuf()->sync() returns -1
F ostream::operator<<(arithmetic and void*): iterator.failed() is true
F ostream::operator<<(streambuf *sb): sb == 0
U ostream::put(char): on failure to insert
U ostream::write(const char*, streamsize): on failure to insert
   ostream::flush(): rdbuf()->pubsync() returns -1

Functions that are required to set failbit:
   operator>>(istream&, string&): extracts 0 chars
   operator<<(ostream&, string): xrdbuf()->sputn() fails
U getline(istream&, string&): stores max_size() chars or extracts
   0 chars
   xxx_get::get(): parse error or bad grouping
F operator>>(istream&, bitset&): stores 0 chars
   operator>>(istream&, complex&): "bad input"
   istream::sentry(istream&): sgetc/sbumpc() returns EOF or stream
   not good
F istream::operator>>(short &val): out of range val
F istream::operator>>(int &val): out of range val
F istream::operator>>(charT*): extracts no chars
F istream::operator>>(charT&): extracts no chars
F istream::operator>>(streambuf *sb): sb == 0 or extracts no chars
U istream::get(): extracts no chars
U istream::get(char&): extracts no chars
U istream::get(char*, streamsize): stores no chars
U istream::get(streambuf &sb): inserts no chars to sb
U istream::getline(char*, streamsize n): extracts 0 or stores
   (n - 1) chars
U istream::read(char*, streamsize): !good() or reaches EOF
U istream::readsome(char*, streamsize): !good()
U istream::putback(char): !good()
U istream::unget(): !good()
U istream::seekg(pos_type): on failure
   ostream::sentry::sentry(ostream&): any reason
U ostream::seekp(pos_type): on failure
   Formatted Output Functions: on failure to generate output
F ostream::operator<<(streambuf*): inserts no chars or exception
   during input
   ifstream::ifstream(const char*): rdbuf()->open() returns 0
   ifstream::open(const char*): rdbuf()->open() returns 0
   ifstream::close(): rdbuf()->close() returns false
   ofstream::ofstream(const char*): rdbuf()->open() returns 0
   ofstream::open(const char*): rdbuf()->open() returns 0
   ofstream::close(): rdbuf()->close() returns false
   fstream::fstream(const char*): rdbuf()->open() returns 0
   fstream::open(const char*): rdbuf()->open() returns 0
   fstream::close(): rdbuf()->close() returns false

F: Formatted I/O Functions
U: Unformatted I/O Functions