]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use floating point exceptions to catch more errors in the testsuite.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 27 May 2015 23:51:43 +0000 (18:51 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 18 Aug 2015 19:51:55 +0000 (14:51 -0500)
tests/tests.h

index 90ce586b77bbaa706c85a66841630f77f81a795a..2d8cfbaa9298e576eb7b1b3a41faf2c9d69099d4 100644 (file)
@@ -32,6 +32,9 @@
 #include <sstream>
 #include <iomanip>
 
+#include <cfenv>
+
+
 // silence extra diagnostics in the testsuite
 #ifdef DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
 DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
@@ -432,6 +435,22 @@ struct SwitchOffStacktrace
 } deal_II_stacktrace_dummy;
 
 
+
+/* Enable floating point exceptions in debug mode and if we have
+   detected that they are usable: */
+
+struct EnableFPE
+{
+  EnableFPE ()
+  {
+#if defined(DEBUG) && defined(DEAL_II_HAVE_FP_EXCEPTIONS)
+    // enable floating point exceptions
+    feenableexcept(FE_DIVBYZERO|FE_INVALID);
+#endif
+    }
+} deal_II_enable_fpe;
+
+
 /* Set grainsizes for parallel mode smaller than they would otherwise be.
  * This is used to test that the parallel algorithms in lac/ work alright:
  */

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.