]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add tests.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sat, 28 Nov 2015 21:57:45 +0000 (15:57 -0600)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 30 Nov 2015 12:49:05 +0000 (06:49 -0600)
tests/base/signaling_nan_derivative_form.cc [new file with mode: 0644]
tests/base/signaling_nan_derivative_form.output [new file with mode: 0644]
tests/base/signaling_nan_symmetric_tensor.cc [new file with mode: 0644]
tests/base/signaling_nan_symmetric_tensor.output [new file with mode: 0644]
tests/base/signaling_nan_tensor.cc [new file with mode: 0644]
tests/base/signaling_nan_tensor.output [new file with mode: 0644]

diff --git a/tests/base/signaling_nan_derivative_form.cc b/tests/base/signaling_nan_derivative_form.cc
new file mode 100644 (file)
index 0000000..18d9cfd
--- /dev/null
@@ -0,0 +1,59 @@
+// ---------------------------------------------------------------------
+//
+// 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 numbers::signaling_nan<DerivativeForm>
+//
+// 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 <deal.II/base/logstream.h>
+#include <deal.II/base/signaling_nan.h>
+#include <fstream>
+#include <iomanip>
+#include <limits>
+#include <fenv.h>
+
+
+
+template <typename T>
+void check ()
+{
+  numbers::signaling_nan<DerivativeForm<1,2,3,T> >();
+  numbers::signaling_nan<DerivativeForm<2,2,2,T> >();
+
+  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<float> ();
+  check<double> ();
+
+  return 0;
+}
+
+
diff --git a/tests/base/signaling_nan_derivative_form.output b/tests/base/signaling_nan_derivative_form.output
new file mode 100644 (file)
index 0000000..8b3b075
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::OK
+DEAL::OK
diff --git a/tests/base/signaling_nan_symmetric_tensor.cc b/tests/base/signaling_nan_symmetric_tensor.cc
new file mode 100644 (file)
index 0000000..105d40c
--- /dev/null
@@ -0,0 +1,58 @@
+// ---------------------------------------------------------------------
+//
+// 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 numbers::signaling_nan<SymmetricTensor>
+//
+// 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 <deal.II/base/logstream.h>
+#include <deal.II/base/signaling_nan.h>
+#include <fstream>
+#include <iomanip>
+#include <limits>
+#include <fenv.h>
+
+
+template <typename T>
+void check ()
+{
+  numbers::signaling_nan<SymmetricTensor<2,2,T> >();
+  numbers::signaling_nan<SymmetricTensor<4,2,T> >();
+
+  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<float> ();
+  check<double> ();
+
+  return 0;
+}
+
+
diff --git a/tests/base/signaling_nan_symmetric_tensor.output b/tests/base/signaling_nan_symmetric_tensor.output
new file mode 100644 (file)
index 0000000..8b3b075
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::OK
+DEAL::OK
diff --git a/tests/base/signaling_nan_tensor.cc b/tests/base/signaling_nan_tensor.cc
new file mode 100644 (file)
index 0000000..88ad0d2
--- /dev/null
@@ -0,0 +1,58 @@
+// ---------------------------------------------------------------------
+//
+// 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 numbers::signaling_nan<Tensor>
+//
+// 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 <deal.II/base/logstream.h>
+#include <deal.II/base/signaling_nan.h>
+#include <fstream>
+#include <iomanip>
+#include <limits>
+#include <fenv.h>
+
+
+template <typename T>
+void check ()
+{
+  numbers::signaling_nan<Tensor<1,2,T> >();
+  numbers::signaling_nan<Tensor<2,2,T> >();
+  numbers::signaling_nan<Tensor<3,2,T> >();
+
+  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<float> ();
+  check<double> ();
+
+  return 0;
+}
+
diff --git a/tests/base/signaling_nan_tensor.output b/tests/base/signaling_nan_tensor.output
new file mode 100644 (file)
index 0000000..8b3b075
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::OK
+DEAL::OK

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.