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] testsuite cleanups



i386/solaris related, but tested on 

x86/linux
gcc
gcc-3_1-branch

2002-03-27  Benjamin Kosnik  <bkoz@redhat.com>

	* include/bits/ostream.tcc (ostream::operator<<(_CharT)): Always
	allocate at least a byte.

	* testsuite/18_support/numeric_limits.cc (test_extrema): Make
	debugger-friendly.
	* testsuite/27_io/streambuf.cc (test07): Fix.
	(test06): Enable.

Index: include/bits/ostream.tcc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/ostream.tcc,v
retrieving revision 1.23
diff -c -p -r1.23 ostream.tcc
*** ostream.tcc	2002/03/06 21:22:53	1.23
--- ostream.tcc	2002/03/28 02:51:35
*************** namespace std 
*** 481,487 ****
  	  try 
  	    {
  	      streamsize __w = __out.width();
! 	      _CharT* __pads = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __w));
  	      __pads[0] = __c;
  	      streamsize __len = 1;
  	      if (__w > __len)
--- 481,487 ----
  	  try 
  	    {
  	      streamsize __w = __out.width();
! 	      _CharT* __pads = static_cast<_CharT*>(__builtin_alloca((sizeof(_CharT) * __w) + 1));
  	      __pads[0] = __c;
  	      streamsize __len = 1;
  	      if (__w > __len)
Index: testsuite/18_support/numeric_limits.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/18_support/numeric_limits.cc,v
retrieving revision 1.10
diff -c -p -r1.10 numeric_limits.cc
*** numeric_limits.cc	2002/03/08 17:59:14	1.10
--- numeric_limits.cc	2002/03/28 02:51:35
***************
*** 1,6 ****
  // 1999-08-23 bkoz
  
! // Copyright (C) 1999, 2001 Free Software Foundation
  //
  // This file is part of the GNU ISO C++ Library.  This library is free
  // software; you can redistribute it and/or modify it under the
--- 1,6 ----
  // 1999-08-23 bkoz
  
! // Copyright (C) 1999, 2001, 2002 Free Software Foundation
  //
  // This file is part of the GNU ISO C++ Library.  This library is free
  // software; you can redistribute it and/or modify it under the
*************** template<typename T>
*** 56,88 ****
  void test_extrema()
  {
    bool test = true;
!   VERIFY( extrema<T>::min == std::numeric_limits<T>::min() );
!   VERIFY( extrema<T>::max == std::numeric_limits<T>::max() );
  }
  
  #ifdef __FreeBSD__
! // This specialization allows the extra precision unmentioned
! // in system headers yet supported by long double on FreeBSD to
! // not cause a gratuitous FAIL for the entire test.  Using this
! // technique to compare the residual against epsilon ensures that
! // any major breakage will still be detected (although obviously not
! // as tight as the exact equality check that would have been generated
! // by default).  This replacement test is allowable by the fact that
! // C++ limits should match the system provided limits for C even if
! // they were wrong verses the actual FP hardware.
  template<>
  void test_extrema<long double>()
  {
    typedef long double T;
    bool test = true;
!   VERIFY( (extrema<T>::min - std::numeric_limits<T>::min())
!             < std::numeric_limits<T>::epsilon() );
!   VERIFY( (std::numeric_limits<T>::min() - extrema<T>::min)
!             < std::numeric_limits<T>::epsilon() );
!   VERIFY( (extrema<T>::max / std::numeric_limits<T>::max())
!             < (1 + std::numeric_limits<T>::epsilon()) );
!   VERIFY( (std::numeric_limits<T>::max() / extrema<T>::max)
!             < (1 + std::numeric_limits<T>::epsilon()) );
  }
  #endif
  
--- 56,94 ----
  void test_extrema()
  {
    bool test = true;
!   T limits_min = std::numeric_limits<T>::min();
!   T limits_max = std::numeric_limits<T>::max();
!   T extrema_min = extrema<T>::min;
!   T extrema_max = extrema<T>::max;
!   VERIFY( extrema_min == limits_min );
!   VERIFY( extrema_max == limits_max );
  }
  
  #ifdef __FreeBSD__
! // This specialization allows the extra precision unmentioned in
! // system headers yet supported by long double on FreeBSD or Solaris
! // to not cause a gratuitous FAIL for the entire test.  Using this
! // technique to compare the residual against epsilon ensures that any
! // major breakage will still be detected (although obviously not as
! // tight as the exact equality check that would have been generated by
! // default).  This replacement test is allowable by the fact that C++
! // limits should match the system provided limits for C even if they
! // were wrong verses the actual FP hardware.
  template<>
  void test_extrema<long double>()
  {
    typedef long double T;
    bool test = true;
!   T limits_min = std::numeric_limits<T>::min();
!   T limits_max = std::numeric_limits<T>::max();
!   T extrema_min = extrema<T>::min;
!   T extrema_max = extrema<T>::max;
!   T epsilon = std::numeric_limits<T>::epsilon();
! 
!   VERIFY( (extrema_min - limits_min) < epsilon );
!   VERIFY( (limits_min - extrema_min) < epsilon );
!   VERIFY( (extrema_max - limits_max) < (1 + epsilon) );
!   VERIFY( (limits_max - extrema_max) < (1 + epsilon) );
  }
  #endif
  
Index: testsuite/27_io/streambuf.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/streambuf.cc,v
retrieving revision 1.10
diff -c -p -r1.10 streambuf.cc
*** streambuf.cc	2001/12/13 00:41:03	1.10
--- streambuf.cc	2002/03/28 02:51:36
***************
*** 1,6 ****
  // 1999-10-11 bkoz
  
! // Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
  //
  // This file is part of the GNU ISO C++ Library.  This library is free
  // software; you can redistribute it and/or modify it under the
--- 1,6 ----
  // 1999-10-11 bkoz
  
! // Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
  //
  // This file is part of the GNU ISO C++ Library.  This library is free
  // software; you can redistribute it and/or modify it under the
*************** void test05()
*** 329,343 ****
  }
  
  // test06
- // XXX this should work, doesn't due to compiler limitations.
- #if 0
  namespace gnu 
  {
    class something_derived;
  }
  
  class gnu::something_derived : std::streambuf { };
- #endif
  
  // libstdc++/3599
  class testbuf2 : public std::streambuf
--- 329,340 ----
*************** protected:
*** 356,366 ****
  void
  test07()
  {
    testbuf2 ob;
    std::ostream out(&ob); 
  
!   VERIFY(out << "gasp");
!   VERIFY(out << std::endl);
  }
  
  int main() 
--- 353,367 ----
  void
  test07()
  {
+   bool test = true;
    testbuf2 ob;
    std::ostream out(&ob); 
+ 
+   out << "gasp";
+   VERIFY(out.good());
  
!   out << std::endl;
!   VERIFY(out.good());
  }
  
  int main() 











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