[PATCH i-g-t v3 03/10] lib/igt_core: Add igt_assert_lt_double()

Nirmoy Das nirmoy.das at linux.intel.com
Wed Aug 28 14:46:55 UTC 2024


On 8/27/2024 6:54 PM, Lucas De Marchi wrote:
> Like the for other types. Avoid the lte variant as it's not good
> practice to compare a double for equality.
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
Reviewed-by: Nirmoy Das <nirmoy.das at intel.com>
> ---
>   lib/igt_core.h | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
>
> diff --git a/lib/igt_core.h b/lib/igt_core.h
> index 06c5314bf..84925767c 100644
> --- a/lib/igt_core.h
> +++ b/lib/igt_core.h
> @@ -998,6 +998,18 @@ void igt_describe_f(const char *fmt, ...);
>    */
>   #define igt_assert_lt_s64(n1, n2) igt_assert_cmps64(n1, <, >=, n2)
>   
> +/**
> + * igt_assert_lt_double:
> + * @n1: first double
> + * @n2: second double
> + *
> + * Fails (sub-)test if the second double is smaller than or equal to the first.
> + *
> + * Like igt_assert(), but displays the values being compared on failure instead
> + * of simply printing the stringified expression.
> + */
> +#define igt_assert_lt_double(n1, n2) igt_assert_cmpdouble(n1, <, >=, n2)
> +
>   /**
>    * igt_assert_fd:
>    * @fd: file descriptor


More information about the igt-dev mailing list