Extend support for float/double tolerances in testing
[alexxy/gromacs.git] / src / gromacs / fft / tests / fft.cpp
index e0d80ad9743f257b0f34a62d4be42b76f10777c5..dfe4dbd3311a2ad01ac646e8c88457340e7b6141 100644 (file)
  */
 #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"
 
@@ -92,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()
         {