From 6e375d2d0a9d237918f29a2203489abd70524316 Mon Sep 17 00:00:00 2001 From: wolf Date: Wed, 4 Feb 2004 16:30:49 +0000 Subject: [PATCH] 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 --- tests/tests.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/tests.h 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; +} -- 2.39.5