]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add tests for numbers::is_finite for complex arguments.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 4 Nov 2007 05:45:08 +0000 (05:45 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 4 Nov 2007 05:45:08 +0000 (05:45 +0000)
git-svn-id: https://svn.dealii.org/trunk@15438 0785d39b-7218-0410-832d-ea1e28bc413d

tests/base/Makefile
tests/base/is_finite_complex.cc [new file with mode: 0644]
tests/base/is_finite_complex/cmp/generic [new file with mode: 0644]
tests/base/is_finite_complex/cmp/powerpc-apple-darwin8.10.0+gcc4.0 [new file with mode: 0644]
tests/base/is_finite_complex/cmp/powerpc-apple-darwin8.8.0+gcc4.0 [new file with mode: 0644]

index 8b6898977f7bec409fea0c0f1f55f9c8f0f5e709..bc98bea5d942c361268fd902ece4cbf6b279fe0f 100644 (file)
@@ -51,7 +51,7 @@ tests_x =  geometry_info_* \
            functions_* \
           function_parser \
           utilities_* \
-          is_finite \
+          is_finite* \
           number_traits_*
 
 ifeq ($(enable-multithreading),no)
diff --git a/tests/base/is_finite_complex.cc b/tests/base/is_finite_complex.cc
new file mode 100644 (file)
index 0000000..2229b82
--- /dev/null
@@ -0,0 +1,75 @@
+//----------------------------  is_finite_complex.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2005, 2006, 2007 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.
+//
+//----------------------------  is_finite_complex.cc  ---------------------------
+
+// check numbers::is_finite for complex arguments
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <fstream>
+#include <iostream>
+#include <limits>
+
+
+template <typename T>
+void check ()
+{
+  using namespace numbers;
+  
+  deallog << std::numeric_limits<typename numbers::NumberTraits<T>::real_type>::quiet_NaN() << "   -->   ";
+  deallog << is_finite(T(std::numeric_limits<typename numbers::NumberTraits<T>::real_type>::quiet_NaN(), 0)) << ' ';
+  deallog << is_finite(T(0,std::numeric_limits<typename numbers::NumberTraits<T>::real_type>::quiet_NaN())) << std::endl;
+
+  deallog << std::numeric_limits<typename numbers::NumberTraits<T>::real_type>::signaling_NaN() << "   -->   ";
+  deallog << is_finite(T(std::numeric_limits<typename numbers::NumberTraits<T>::real_type>::signaling_NaN(), 0)) << ' ';
+  deallog << is_finite(T(0,std::numeric_limits<typename numbers::NumberTraits<T>::real_type>::signaling_NaN())) << std::endl;
+
+  deallog << std::numeric_limits<typename numbers::NumberTraits<T>::real_type>::infinity() << "   -->   ";
+  deallog << is_finite(T(std::numeric_limits<typename numbers::NumberTraits<T>::real_type>::infinity(), 0)) << ' ';
+  deallog << is_finite(T(0, std::numeric_limits<typename numbers::NumberTraits<T>::real_type>::infinity())) << std::endl;
+
+  deallog << -std::numeric_limits<typename numbers::NumberTraits<T>::real_type>::infinity() << "   -->   ";
+  deallog << is_finite(T(-std::numeric_limits<typename numbers::NumberTraits<T>::real_type>::infinity(), 0)) << ' ';
+  deallog << is_finite(T(0, -std::numeric_limits<typename numbers::NumberTraits<T>::real_type>::infinity())) << std::endl;
+
+  deallog << std::numeric_limits<typename numbers::NumberTraits<T>::real_type>::min() << "   -->   ";
+  deallog << is_finite(T(std::numeric_limits<typename numbers::NumberTraits<T>::real_type>::min(), 0)) << ' ';
+  deallog << is_finite(T(0,std::numeric_limits<typename numbers::NumberTraits<T>::real_type>::min())) << std::endl;
+
+  deallog << std::numeric_limits<typename numbers::NumberTraits<T>::real_type>::max() << "   -->   ";
+  deallog << is_finite(T(std::numeric_limits<typename numbers::NumberTraits<T>::real_type>::max(), 0)) << ' ';
+  deallog << is_finite(T(0, std::numeric_limits<typename numbers::NumberTraits<T>::real_type>::max())) << std::endl;
+
+  deallog << static_cast<typename numbers::NumberTraits<T>::real_type> (1) << "   -->   ";
+  deallog << is_finite(T(static_cast<typename numbers::NumberTraits<T>::real_type> (1), 0)) << ' ';
+  deallog << is_finite(T(0, static_cast<typename numbers::NumberTraits<T>::real_type> (1))) << std::endl;
+
+  deallog << static_cast<typename numbers::NumberTraits<T>::real_type> (-1) << "   -->   ";
+  deallog << is_finite(T(static_cast<typename numbers::NumberTraits<T>::real_type> (-1), 0)) << ' ';
+  deallog << is_finite(T(0, static_cast<typename numbers::NumberTraits<T>::real_type> (-1))) << std::endl;
+}
+
+
+int main ()
+{
+  std::ofstream logfile("is_finite_complex/output");
+  logfile.precision(3);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  check<std::complex<double> > ();
+  check<std::complex<long double> > ();
+  
+  return 0;
+}
+
diff --git a/tests/base/is_finite_complex/cmp/generic b/tests/base/is_finite_complex/cmp/generic
new file mode 100644 (file)
index 0000000..e287678
--- /dev/null
@@ -0,0 +1,33 @@
+
+DEAL::nan   -->   0
+DEAL::nan   -->   0
+DEAL::inf   -->   0
+DEAL::-inf   -->   0
+DEAL::0   -->   1
+DEAL::1.80e+308   -->   1
+DEAL::1.00   -->   1
+DEAL::-1.00   -->   1
+DEAL::nan   -->   0
+DEAL::nan   -->   0
+DEAL::inf   -->   0
+DEAL::-inf   -->   0
+DEAL::3.36e-4932   -->   1
+DEAL::1.19e+4932   -->   0
+DEAL::1.00   -->   1
+DEAL::-1.00   -->   1
+DEAL::0   -->   1
+DEAL::0   -->   1
+DEAL::0   -->   1
+DEAL::0   -->   1
+DEAL::-2147483648   -->   1
+DEAL::2147483647   -->   1
+DEAL::1   -->   1
+DEAL::-1   -->   1
+DEAL::0   -->   1
+DEAL::0   -->   1
+DEAL::0   -->   1
+DEAL::0   -->   1
+DEAL::0   -->   1
+DEAL::4294967295   -->   1
+DEAL::1   -->   1
+DEAL::4294967295   -->   1
diff --git a/tests/base/is_finite_complex/cmp/powerpc-apple-darwin8.10.0+gcc4.0 b/tests/base/is_finite_complex/cmp/powerpc-apple-darwin8.10.0+gcc4.0
new file mode 100644 (file)
index 0000000..c20de19
--- /dev/null
@@ -0,0 +1,33 @@
+
+DEAL::nan   -->   0
+DEAL::nan   -->   0
+DEAL::inf   -->   0
+DEAL::-inf   -->   0
+DEAL::0   -->   1
+DEAL::1.80e+308   -->   1
+DEAL::1.00   -->   1
+DEAL::-1.00   -->   1
+DEAL::nan   -->   0
+DEAL::nan   -->   0
+DEAL::inf   -->   0
+DEAL::-inf   -->   0
+DEAL::2.00e-292   -->   1
+DEAL::1.80e+308   -->   1
+DEAL::1.00   -->   1
+DEAL::-1.00   -->   1
+DEAL::0   -->   1
+DEAL::0   -->   1
+DEAL::0   -->   1
+DEAL::0   -->   1
+DEAL::-2147483648   -->   1
+DEAL::2147483647   -->   1
+DEAL::1   -->   1
+DEAL::-1   -->   1
+DEAL::0   -->   1
+DEAL::0   -->   1
+DEAL::0   -->   1
+DEAL::0   -->   1
+DEAL::0   -->   1
+DEAL::4294967295   -->   1
+DEAL::1   -->   1
+DEAL::4294967295   -->   1
diff --git a/tests/base/is_finite_complex/cmp/powerpc-apple-darwin8.8.0+gcc4.0 b/tests/base/is_finite_complex/cmp/powerpc-apple-darwin8.8.0+gcc4.0
new file mode 100644 (file)
index 0000000..c20de19
--- /dev/null
@@ -0,0 +1,33 @@
+
+DEAL::nan   -->   0
+DEAL::nan   -->   0
+DEAL::inf   -->   0
+DEAL::-inf   -->   0
+DEAL::0   -->   1
+DEAL::1.80e+308   -->   1
+DEAL::1.00   -->   1
+DEAL::-1.00   -->   1
+DEAL::nan   -->   0
+DEAL::nan   -->   0
+DEAL::inf   -->   0
+DEAL::-inf   -->   0
+DEAL::2.00e-292   -->   1
+DEAL::1.80e+308   -->   1
+DEAL::1.00   -->   1
+DEAL::-1.00   -->   1
+DEAL::0   -->   1
+DEAL::0   -->   1
+DEAL::0   -->   1
+DEAL::0   -->   1
+DEAL::-2147483648   -->   1
+DEAL::2147483647   -->   1
+DEAL::1   -->   1
+DEAL::-1   -->   1
+DEAL::0   -->   1
+DEAL::0   -->   1
+DEAL::0   -->   1
+DEAL::0   -->   1
+DEAL::0   -->   1
+DEAL::4294967295   -->   1
+DEAL::1   -->   1
+DEAL::4294967295   -->   1

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.