Boost logo

Boost :

From: Paul A Bristow (pbristow_at_[hidden])
Date: 2006-11-09 05:19:22


I'd like to strongly add my vote for these too. They are a continuing nuisance, of which I have recent and relevant experience
testing the statistical distributions - plug ;-).

I'd also like to see additional macros provided to exactly duplicate BOOST_CHECK_CLOSE (and warn and require of course) but with
names

BOOST_CHECK_CLOSE_PERCENT ...

to reduce continuing confusion with percent and fractions.

Thanks

Paul

PS Boost.Test remains an extremely valuable test tool - I vow never to start coding again without using it as I go along!

| -----Original Message-----
| From: boost-bounces_at_[hidden]
| [mailto:boost-bounces_at_[hidden]] On Behalf Of Gennadiy Rozental
| Sent: 08 November 2006 18:48
| To: boost_at_[hidden]
| Subject: Re: [boost] Boost.Test feature request
|
|
| "John Maddock" <john_at_[hidden]> wrote in message
| news:000701c70357$ae886180$c9541b56_at_fuji...
| >I have a couple of annoying issues with Boost.Test's output
| on failed tests:

| > 2) If the type has no numeric_limits support, say if it's
| a composite
| > type,
| > like std::complex<double> then you don't get enough digits
| to tell what
| > the
| > problem is. Could the code default to whatever digits
| long-double has?
| > Again a minor change to print_log_value (in my experience
| std lib's ignore
| > requests for more digits than a type really has anyway, so
| it should be
| > harmless?).
|
| Could you provide the code?

Perhaps?

void set_precision( std::ostream& ostr, mpl::false_ )
{
if(std::numeric_limits<T>::is_specialized && std::numeric_limits<T>::radix == 10)
{ // All decimal types, perhaps including NTL::RR,
  // where digits10 == runtime set precision
  // (but where digits (significand bits) may not be meaningful.
  ostr.precision(std::numeric_limits<T>::digits10)
}
else if (std::numeric_limits<T>::digits == 0)
{ // User-defined type or composite type like std::complex<double>
  // for which digits (significand bits) value has not been assigned,
  // even if is_specialized, perhaps assigning other values.
  ostr.precision(std::numeric_limits<long double>::digits10 + 2;)
  // Default to the longest built-in type, plus a couple of noisy digits.
}
else if( std::numeric_limits<T>::is_specialized && std::numeric_limits<T>::radix == 2 )
{ // && std::numeric_limits<T>::digits != 0)
  // Ensure all potentially significant, if noisy, digits are shown.
  ostr.precision( 2 + std::numeric_limits<T>::digits * 301/1000 );
  // std::numeric_limits<T>::max_digits10; for C++0x
} // void set_precision

Untested!

  
Paul

---
Paul A Bristow
Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB
+44 1539561830 & SMS, Mobile +44 7714 330204 & SMS
pbristow_at_[hidden]
 

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk