[v3] Fix test03 in ostream_inserter_arith.cc
Paolo Carlini
pcarlini@unitus.it
Mon Jan 28 12:18:00 GMT 2002
Hi,
I have committed this patch, tested by myself on i686-pc-linux-gnu and by Ulrich
Weigand and Andreas Schwab on s390x-ibm-linux and ia64-suse-linux, respectively.
Approved by Benjamin Kosnik.
Cheeers,
Paolo.
///////////
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
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- gcc/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc 2002/01/23
01:12:10 1.12
+++ gcc/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc 2002/01/28
20:06:15 1.13
@@ -311,16 +311,29 @@
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;
More information about the Gcc-patches
mailing list