summaryrefslogtreecommitdiff
path: root/tests/checkasm/checkasm.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/checkasm/checkasm.c')
-rw-r--r--tests/checkasm/checkasm.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index 0cb4ed199a..0b86627cc9 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -131,6 +131,7 @@ static const struct {
#endif
#if CONFIG_AVUTIL
{ "fixed_dsp", checkasm_check_fixed_dsp },
+ { "float_dsp", checkasm_check_float_dsp },
#endif
{ NULL }
};
@@ -285,6 +286,25 @@ int float_near_abs_eps_array_ulp(const float *a, const float *b, float eps,
return 1;
}
+int double_near_abs_eps(double a, double b, double eps)
+{
+ double abs_diff = fabs(a - b);
+
+ return abs_diff < eps;
+}
+
+int double_near_abs_eps_array(const double *a, const double *b, double eps,
+ unsigned len)
+{
+ unsigned i;
+
+ for (i = 0; i < len; i++) {
+ if (!double_near_abs_eps(a[i], b[i], eps))
+ return 0;
+ }
+ return 1;
+}
+
/* Print colored text to stderr if the terminal supports it */
static void color_printf(int color, const char *fmt, ...)
{