+2003-03-06 Jerry Quinn <jlquinn@optonline.net>
+
+ * testsuite/27_io/ios_base_storage.cc (test02): Set exception
+ mask. Test setting small-numbered pword and iword slots. Test
+ behavior at limit of numeric_limits::max. Check that values are
+ still good after failures.
+
2003-03-06 Jerry Quinn <jlquinn@optonline.net>
* src/ios.cc (ios_base::_M_init): Remove _M_word_size.
std::stringbuf strbuf;
std::ios ios(&strbuf);
+ ios.exceptions(std::ios::badbit);
+
long l = 0;
void* v = 0;
// pword
+ ios.pword(1) = v;
+ VERIFY( ios.pword(1) == v );
+
try
{
v = ios.pword(max);
}
VERIFY( v == 0 );
+ VERIFY( ios.pword(1) == v );
+
+ // max is different code path from max-1
+ v = &test;
+ try
+ {
+ v = ios.pword(std::numeric_limits<int>::max());
+ }
+ catch(std::ios_base::failure& obj)
+ {
+ // Ok.
+ VERIFY( ios.bad() );
+ }
+ catch(...)
+ {
+ VERIFY( test = false );
+ }
+ VERIFY( v == &test );
+
// iword
+ ios.iword(1) = 1;
+ VERIFY( ios.iword(1) == 1 );
+
try
{
l = ios.iword(max);
VERIFY( test = false );
}
VERIFY( l == 0 );
+
+ VERIFY( ios.iword(1) == 1 );
+
+ // max is different code path from max-1
+ l = 1;
+ try
+ {
+ l = ios.iword(std::numeric_limits<int>::max());
+ }
+ catch(std::ios_base::failure& obj)
+ {
+ // Ok.
+ VERIFY( ios.bad() );
+ }
+ catch(...)
+ {
+ VERIFY( test = false );
+ }
+ VERIFY( l == 1 );
+
}
class derived : public std::ios_base