[FFmpeg-devel] [PATCH 04/17] tests/checkasm: add checkasm_check_float

Martin Storsjö martin at martin.st
Sun May 18 22:24:16 EEST 2025


On Sun, 18 May 2025, Niklas Haas wrote:

> From: Niklas Haas <git at haasn.dev>
>
> ---
> tests/checkasm/checkasm.c | 1 +
> tests/checkasm/checkasm.h | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
> index 71d1e5766c..c77216ed57 100644
> --- a/tests/checkasm/checkasm.c
> +++ b/tests/checkasm/checkasm.c
> @@ -1265,3 +1265,4 @@ DEF_CHECKASM_CHECK_FUNC(uint16_t, "%04x")
> DEF_CHECKASM_CHECK_FUNC(uint32_t, "%08x")
> DEF_CHECKASM_CHECK_FUNC(int16_t,  "%6d")
> DEF_CHECKASM_CHECK_FUNC(int32_t,  "%9d")
> +DEF_CHECKASM_CHECK_FUNC(float,    "%g")
> diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
> index ad7ed10613..f1046bc035 100644
> --- a/tests/checkasm/checkasm.h
> +++ b/tests/checkasm/checkasm.h
> @@ -422,6 +422,7 @@ DECL_CHECKASM_CHECK_FUNC(uint16_t);
> DECL_CHECKASM_CHECK_FUNC(uint32_t);
> DECL_CHECKASM_CHECK_FUNC(int16_t);
> DECL_CHECKASM_CHECK_FUNC(int32_t);
> +DECL_CHECKASM_CHECK_FUNC(float);
>
> #define PASTE(a,b) a ## b
> #define CONCAT(a,b) PASTE(a,b)
> -- 
> 2.49.0

While this change in itself is ok, this uses memcmp for the check 
function, which usually isn't ideal for float based tests; making the 
tests use some given epsilon instead probably is better in general.

// Martin



More information about the ffmpeg-devel mailing list