diff options
author | Jerry Quinn <jlquinn@optonline.net> | 2003-03-06 22:37:01 +0000 |
---|---|---|
committer | Benjamin Kosnik <bkoz@gcc.gnu.org> | 2003-03-06 22:37:01 +0000 |
commit | a9aa7083edffef0a326154cc39f429e55a12d846 (patch) | |
tree | 0ab56d29605ebe4694ab53b6a737221ff326a83d | |
parent | 37f5242b58f51568fcb60fd2fb35ca61c92b2305 (diff) | |
download | gcc-a9aa7083edffef0a326154cc39f429e55a12d846.zip gcc-a9aa7083edffef0a326154cc39f429e55a12d846.tar.gz gcc-a9aa7083edffef0a326154cc39f429e55a12d846.tar.bz2 |
ios_base_storage.cc (test02): Set exception mask.
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.
From-SVN: r63908
-rw-r--r-- | libstdc++-v3/ChangeLog | 7 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/27_io/ios_base_storage.cc | 47 |
2 files changed, 54 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 965a333..f0bd09a 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,12 @@ 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. (ios_base::ios_base): Set _M_word, _M_word_size. (ios_base::~ios_base): Remove redundant test. diff --git a/libstdc++-v3/testsuite/27_io/ios_base_storage.cc b/libstdc++-v3/testsuite/27_io/ios_base_storage.cc index 6af52c0..7033466 100644 --- a/libstdc++-v3/testsuite/27_io/ios_base_storage.cc +++ b/libstdc++-v3/testsuite/27_io/ios_base_storage.cc @@ -55,10 +55,15 @@ void test02() 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); @@ -74,7 +79,29 @@ void test02() } 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); @@ -89,6 +116,26 @@ void test02() 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 |