diff options
author | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-03-06 22:37:01 +0000 |
---|---|---|
committer | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-03-06 22:37:01 +0000 |
commit | d1a218b75b96f673ef90f9b4082f154420883dec (patch) | |
tree | 0ab56d29605ebe4694ab53b6a737221ff326a83d /libstdc++-v3/testsuite | |
parent | 7ed3fdd68b399f73ab34ae113c658052e8dda49d (diff) | |
download | gcc-d1a218b75b96f673ef90f9b4082f154420883dec.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@63908 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r-- | libstdc++-v3/testsuite/27_io/ios_base_storage.cc | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/27_io/ios_base_storage.cc b/libstdc++-v3/testsuite/27_io/ios_base_storage.cc index 6af52c0a8c0..7033466e691 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 |