Commit a852d50f by Paolo Carlini Committed by Paolo Carlini

ostream_inserter_arith.cc (test03): Better fix for 32/64 bit architectures...

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

        * testsuite/27_io/ostream_inserter_arith.cc (test03):
        Better fix for 32/64 bit architectures, avoiding the
        implicit assumption that CHAR_BIT == 8.

From-SVN: r49342
parent 5748ebeb
2002-01-30 Paolo Carlini <pcarlini@unitus.it>
* testsuite/27_io/ostream_inserter_arith.cc (test03):
Better fix for 32/64 bit architectures, avoiding the
implicit assumption that CHAR_BIT == 8.
2002-01-28 Phil Edwards <pme@gcc.gnu.org>
* Makefile.am (doxygen, doxygen-maint, doxygen-man): Tweak targets.
......
......@@ -312,26 +312,26 @@ test03()
ostream o(&strbuf);
o << oct << s << ' ' << hex << s;
if (sizeof(short) == 2)
if (numeric_limits<short>::digits + 1 == 16)
VERIFY( strbuf.str() == "177777 ffff" );
else // sizeof(short) == 4
else
VERIFY( strbuf.str() == "37777777777 ffffffff" );
strbuf.str(str_blank);
o << oct << i << ' ' << hex << i;
if (sizeof(int) == 2)
if (numeric_limits<int>::digits + 1 == 16)
VERIFY( strbuf.str() == "177777 ffff" );
else if (sizeof(int) == 4)
else if (numeric_limits<int>::digits + 1 == 32)
VERIFY( strbuf.str() == "37777777777 ffffffff" );
else // sizeof(int) == 8
else
VERIFY( strbuf.str() == "1777777777777777777777 "
"ffffffffffffffff" );
strbuf.str(str_blank);
o << oct << l << ' ' << hex << l;
if (sizeof(long) == 4)
if (numeric_limits<long>::digits + 1 == 32)
VERIFY( strbuf.str() == "37777777777 ffffffff" );
else // sizeof(long) == 8
else
VERIFY( strbuf.str() == "1777777777777777777777 "
"ffffffffffffffff" );
strbuf.str(str_blank);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment