[Piglit] [PATCH] Use right comparison function for double
Jan Vesely
jv356 at scarletmail.rutgers.edu
Wed Aug 24 15:11:16 UTC 2016
On Tue, 2016-08-23 at 21:33 -0700, arsenm2 at gmail.com wrote:
> From: Matt Arsenault <arsenm2 at gmail.com>
I guess more cases can be consolidated this way...
Reviewed-by: Jan Vesely <jan.vesely at rutgers.edu>
Jan
>
> ---
> tests/cl/program/program-tester.c | 12 ++++++------
> tests/util/piglit-util-cl.c | 2 +-
> 2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/tests/cl/program/program-tester.c
> b/tests/cl/program/program-tester.c
> index 25b677f..1a87610 100644
> --- a/tests/cl/program/program-tester.c
> +++ b/tests/cl/program/program-tester.c
> @@ -2115,14 +2115,14 @@ check_test_arg_value(struct test_arg
> test_arg,
> }
> \
> }
> \
> return true;
> -#define CASEF(enum_type, type,
> cl_type) \
> +#define CASEF(enum_type, type, cl_type, testfn)
> \
> case
> enum_type: \
> for(i = 0; i < test_arg.length; i++)
> { \
> for(c = 0; c < test_arg.cl_size; c++)
> { \
> rb = i*test_arg.cl_mem_size +
> c; \
> - if(!piglit_cl_probe_floating(((cl_ty
> pe*)value)[rb], \
> - ((cl_ty
> pe*)test_arg.value)[rb], \
> - test_ar
> g.ulp)) { \
> + if(!testfn(((cl_type*)value)[rb],
> \
> + ((cl_type*)test_arg.value
> )[rb], \
> + test_arg.ulp))
> { \
> ra = i*test_arg.cl_size +
> c; \
> printf("Error at %s[%zu]\n",
> type, ra); \
> return
> false; \
> @@ -2141,8 +2141,8 @@ check_test_arg_value(struct test_arg test_arg,
> CASEI(TYPE_LONG, "long", cl_long)
> CASEU(TYPE_ULONG, "ulong", cl_ulong)
> CASEH(TYPE_HALF, "half", cl_half)
> - CASEF(TYPE_FLOAT, "float", cl_float)
> - CASEF(TYPE_DOUBLE, "double", cl_double)
> + CASEF(TYPE_FLOAT, "float", cl_float,
> piglit_cl_probe_floating)
> + CASEF(TYPE_DOUBLE, "double", cl_double,
> piglit_cl_probe_double)
> }
>
> #undef CASEF
> diff --git a/tests/util/piglit-util-cl.c b/tests/util/piglit-util-
> cl.c
> index fb32fee..dba3263 100644
> --- a/tests/util/piglit-util-cl.c
> +++ b/tests/util/piglit-util-cl.c
> @@ -130,7 +130,7 @@ piglit_cl_probe_double(double value, double
> expect, uint64_t ulp)
> diff = fabsl(value - expect);
>
> if(diff > ulp || isnan(value)) {
> - printf("Expecting %f (0x%lx) with tolerance %f (%lu
> ulps), but got %f (0x%lx)\n",
> + printf("Expecting %f (0x%" PRIx64") with tolerance
> %f (%lu ulps), but got %f (0x%" PRIx64")\n",
> e.f, e.u, t.f, t.u, v.f, v.u);
> return false;
> }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20160824/7e290ef5/attachment.sig>
More information about the Piglit
mailing list