Extend support for float/double tolerances in testing
[alexxy/gromacs.git] / src / gromacs / fft / tests / fft.cpp
index bc3dd9ce71e08c6fee8fcdc52732f283ca2c06cb..dfe4dbd3311a2ad01ac646e8c88457340e7b6141 100644 (file)
  * \author Roland Schulz <roland@utk.edu>
  * \ingroup module_fft
  */
+#include "gmxpre.h"
+
+#include "gromacs/fft/fft.h"
+
 #include <vector>
 
 #include <gtest/gtest.h>
 
-#include "gromacs/fft/fft.h"
 #include "gromacs/fft/parallel_3dfft.h"
 #include "gromacs/utility/stringutil.h"
 
@@ -90,11 +93,8 @@ class BaseFFTTest : public ::testing::Test
             // TODO: These tolerances are just something that has been observed
             // to be sufficient to pass the tests.  It would be nicer to
             // actually argue about why they are sufficient (or what is).
-#ifdef GMX_DOUBLE
-            checker_.setDefaultTolerance(gmx::test::relativeRealTolerance(10.0, 512));
-#else
-            checker_.setDefaultTolerance(gmx::test::relativeRealTolerance(10.0, 64));
-#endif
+            checker_.setDefaultTolerance(
+                    gmx::test::relativeToleranceAsPrecisionDependentUlp(10.0, 64, 512));
         }
         ~BaseFFTTest()
         {