summaryrefslogtreecommitdiff
path: root/libs/ardour/test
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-10-06 20:10:42 +0200
committerRobin Gareus <robin@gareus.org>2015-10-06 20:10:42 +0200
commite78f0fe52655261a61d7239a89625076a4b65b06 (patch)
tree4737b8d333b5130abbc4f21ae1795ae041c6f8fc /libs/ardour/test
parent6b00e149d268939bce3b48a2998676c7109c10f5 (diff)
CPPUNIT workaround for mingw/wine/windows
Diffstat (limited to 'libs/ardour/test')
-rw-r--r--libs/ardour/test/dsp_load_calculator_test.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/libs/ardour/test/dsp_load_calculator_test.cc b/libs/ardour/test/dsp_load_calculator_test.cc
index f4ce68220c..b4a9ed236b 100644
--- a/libs/ardour/test/dsp_load_calculator_test.cc
+++ b/libs/ardour/test/dsp_load_calculator_test.cc
@@ -6,6 +6,22 @@
CPPUNIT_TEST_SUITE_REGISTRATION (DSPLoadCalculatorTest);
+
+#if defined(PLATFORM_WINDOWS) && defined(COMPILER_MINGW)
+/* cppunit-1.13.2 uses assertion_traits<double>
+ * sprintf( , "%.*g", precision, x)
+ * to format a double. The actual comparison is performed on a string.
+ * This is problematic with mingw/windows|wine, "%.*g" formatting fails.
+ *
+ * This quick hack compares float, however float compatisons are at most Y.MMMM+eXX,
+ * the max precision needs to be limited. to the last mantissa digit.
+ *
+ * Anyway, actual maths is verified with Linux and OSX unit-tests,
+ * and this needs to go to https://sourceforge.net/p/cppunit/bugs/
+ */
+#define CPPUNIT_ASSERT_DOUBLES_EQUAL(A,B,P) CPPUNIT_ASSERT_EQUAL((float)rint ((A) / (P)),(float)rint ((B) / (P)))
+#endif
+
using namespace std;
using namespace ARDOUR;