shithub: aubio

Download patch

ref: 9279ba044c3eb637839277829d6337e530f71a1f
parent: c62243f3824ca2f1c9aaee0c427b6db541518275
author: Paul Brossier <piem@piem.org>
date: Fri May 10 06:40:29 EDT 2019

[tests] use fabs in test-timestretch to avoid double truncation

--- a/tests/src/effects/test-timestretch.c
+++ b/tests/src/effects/test-timestretch.c
@@ -1,6 +1,5 @@
 #define AUBIO_UNSTABLE 1
 #include <aubio.h>
-#include "aubio_priv.h"
 #include "utils_tests.h"
 
 int test_wrong_params(void);
@@ -128,7 +127,7 @@
 
   if (aubio_timestretch_get_transpose(p) != 0) return 1;
   if (aubio_timestretch_set_transpose(p, 2.)) return 1;
-  if (ABS(aubio_timestretch_get_transpose(p) - 2.) > 1.e-6) return 1;
+  if (fabs(aubio_timestretch_get_transpose(p) - 2.) >= 1e-6) return 1;
   if (!aubio_timestretch_set_transpose(p, 200.)) return 1;
   if (!aubio_timestretch_set_transpose(p, -200.)) return 1;
   if (aubio_timestretch_set_transpose(p, 0.)) return 1;
@@ -135,13 +134,13 @@
 
   if (aubio_timestretch_get_pitchscale(p) != 1) return 1;
   if (aubio_timestretch_set_pitchscale(p, 2.)) return 1;
-  if (ABS(aubio_timestretch_get_pitchscale(p) - 2.) > 1.e-6) return 1;
+  if (fabs(aubio_timestretch_get_pitchscale(p) - 2.) >= 1e-6) return 1;
   if (!aubio_timestretch_set_pitchscale(p, 0.)) return 1;
   if (!aubio_timestretch_set_pitchscale(p, 6.)) return 1;
 
   if (aubio_timestretch_get_stretch(p) != stretch) return 1;
   if (aubio_timestretch_set_stretch(p, 2.)) return 1;
-  if (ABS(aubio_timestretch_get_stretch(p) - 2.) > 1.e-6) return 1;
+  if (fabs(aubio_timestretch_get_stretch(p) - 2.) >= 1e-6) return 1;
   if (!aubio_timestretch_set_stretch(p, 0.)) return 1;
   if (!aubio_timestretch_set_stretch(p, 41.)) return 1;