From: Wolfgang Bangerth Date: Wed, 4 Feb 2004 16:30:49 +0000 (+0000) Subject: Add a file with common definitions to be used by all testcases. X-Git-Tag: v8.0.0~15845 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eef2154790600024c9ccc72da34392b841ff9f0d;p=dealii.git Add a file with common definitions to be used by all testcases. git-svn-id: https://svn.dealii.org/trunk@8395 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/tests.h b/tests/tests.h new file mode 100644 index 0000000000..cb00080bd6 --- /dev/null +++ b/tests/tests.h @@ -0,0 +1,44 @@ +//---------------------------- tests.h --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- tests.h --------------------------- + + +// common definitions used in all the tests + + +#include +#include + +// overload floating point output operators for LogStream so that small +// numbers below a certain threshold are simply printed as zeros. this removes +// a number of possible places where output may differ depending on platform, +// compiler options, etc, simply because round-off is different. +LogStream & operator << (LogStream &logstream, + const double d) +{ + if (std::fabs (d) < 1e-10) + logstream << 0.; + else + logstream << d; + return logstream; +} + + +LogStream & operator << (LogStream &logstream, + const float d) +{ + if (std::fabs (d) < 1e-8) + logstream << 0.; + else + logstream << d; + return logstream; +}