ostream_inserter_arith.cc (test03): Fix to deal correctly with both 32 bit and 64 bit architectures

2002-01-28  Paolo Carlini  <pcarlini@unitus.it>

	* testsuite/27_io/ostream_inserter_arith.cc (test03):
	Fix to deal correctly with both 32 bit and 64 bit architectures

From-SVN: r49295
This commit is contained in:
Paolo Carlini 2002-01-28 21:06:15 +01:00 committed by Paolo Carlini
parent 7dc3f8c018
commit 4debe14deb
2 changed files with 24 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2002-01-28 Paolo Carlini <pcarlini@unitus.it>
* testsuite/27_io/ostream_inserter_arith.cc (test03):
Fix to deal correctly with both 32 bit and 64 bit architectures
2002-01-25 Loren Rittle <ljrittle@acm.org>
* testsuite/thread/pthread1.cc: Use one condition variable

View File

@ -311,16 +311,29 @@ test03()
stringbuf strbuf;
ostream o(&strbuf);
o << oct << s << ' ' << hex << s;
VERIFY( strbuf.str() == "177777 ffff" ); // Assuming 2byte-shorts
o << oct << s << ' ' << hex << s;
if (sizeof(short) == 2)
VERIFY( strbuf.str() == "177777 ffff" );
else // sizeof(short) == 4
VERIFY( strbuf.str() == "37777777777 ffffffff" );
strbuf.str(str_blank);
o << oct << i << ' ' << hex << i;
VERIFY( strbuf.str() == "37777777777 ffffffff" );
o << oct << i << ' ' << hex << i;
if (sizeof(int) == 2)
VERIFY( strbuf.str() == "177777 ffff" );
else if (sizeof(int) == 4)
VERIFY( strbuf.str() == "37777777777 ffffffff" );
else // sizeof(int) == 8
VERIFY( strbuf.str() == "1777777777777777777777 "
"ffffffffffffffff" );
strbuf.str(str_blank);
o << oct << l << ' ' << hex << l;
VERIFY( strbuf.str() == "37777777777 ffffffff" );
o << oct << l << ' ' << hex << l;
if (sizeof(long) == 4)
VERIFY( strbuf.str() == "37777777777 ffffffff" );
else // sizeof(long) == 8
VERIFY( strbuf.str() == "1777777777777777777777 "
"ffffffffffffffff" );
strbuf.str(str_blank);
o << showpos << hex << showbase << 11;