From cbe83fb2cfd4e6a15c9fd9cca6044cf4c99ba336 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sun, 29 Nov 2015 13:27:39 -0600 Subject: [PATCH] Add another test. --- tests/base/signaling_nan_table.cc | 61 +++++++++++++++++++++++++++ tests/base/signaling_nan_table.output | 3 ++ 2 files changed, 64 insertions(+) create mode 100644 tests/base/signaling_nan_table.cc create mode 100644 tests/base/signaling_nan_table.output diff --git a/tests/base/signaling_nan_table.cc b/tests/base/signaling_nan_table.cc new file mode 100644 index 0000000000..739b645d37 --- /dev/null +++ b/tests/base/signaling_nan_table.cc @@ -0,0 +1,61 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2015 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +// check Table<2,double> with elements numbers::signaling_nan +// +// the test only checks that the function can be called. It would have +// been nicer to output the tensors (which would also verify the +// correct output type, as well as that indeed *each* element is +// correctly filled), but outputting a sNaN triggers a floating point +// exception as well + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include + + +template +void check () +{ + Table<2,T> t; + const T x = numbers::signaling_nan(); + const T array[6] = { x,x,x,x,x,x }; + + t.reinit (2,3, &x); + + deallog << "OK" << std::endl; +} + + +int main () +{ + std::ofstream logfile("output"); + deallog << std::setprecision(3); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + check (); + check (); + + return 0; +} + diff --git a/tests/base/signaling_nan_table.output b/tests/base/signaling_nan_table.output new file mode 100644 index 0000000000..8b3b075900 --- /dev/null +++ b/tests/base/signaling_nan_table.output @@ -0,0 +1,3 @@ + +DEAL::OK +DEAL::OK -- 2.39.5