This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] Improved fix for ostream_inserter_arith.cc test03


Hi,

I have implemented Richard Henderson's indications for improving my original:

    http://gcc.gnu.org/ml/gcc-patches/2002-01/msg02004.html

Tested on i686-pc-linux-gnu, reviewed by Benjamin Kosnik and committed.

Cheers,
Paolo.

//////////////

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.

===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- gcc/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc  2002/01/28
20:06:15     1.13
+++ gcc/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc  2002/01/30
20:45:18     1.14
@@ -312,26 +312,26 @@
   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);



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]