ostream_inserter_arith.cc (test03): Fix to deal correctly with both 32 bit and 64...
authorPaolo Carlini <pcarlini@unitus.it>
Mon, 28 Jan 2002 20:06:15 +0000 (21:06 +0100)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 28 Jan 2002 20:06:15 +0000 (20:06 +0000)
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

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc

index 3370daeff9f6682431fb1750c001ac4e2d131cb3..044f549587bcbf28a5ce1048e99a6ee28d0d62fd 100644 (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
index dd443d99bd802029ffc5eb9fb855b5e56c94caa8..bf93950c8c4095e5a56663f956b0312f5105fc61 100644 (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;