From 733823c890f802c63bf97b5449d0ca658cd68f9d Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 27 Apr 2017 23:52:44 +0200 Subject: [PATCH] d3dx9/tests: Get rid of compare_planes. Signed-off-by: Henri Verbeet Signed-off-by: Matteo Bruni Signed-off-by: Alexandre Julliard --- dlls/d3dx9_36/tests/math.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/dlls/d3dx9_36/tests/math.c b/dlls/d3dx9_36/tests/math.c index 763454d916b..c0f6bee0861 100644 --- a/dlls/d3dx9_36/tests/math.c +++ b/dlls/d3dx9_36/tests/math.c @@ -199,18 +199,6 @@ static void expect_vec4_array_(unsigned int line, SIZE_T count, const D3DXVECTOR } } -#define compare_planes(exp, out) \ - for (i = 0; i < ARRAY_SIZE + 2; ++i) { \ - ok(relative_error(exp[i].a, out[i].a) < admitted_error && \ - relative_error(exp[i].b, out[i].b) < admitted_error && \ - relative_error(exp[i].c, out[i].c) < admitted_error && \ - relative_error(exp[i].d, out[i].d) < admitted_error, \ - "Got (%f, %f, %f, %f), expected (%f, %f, %f, %f) for index %d.\n", \ - out[i].a, out[i].b, out[i].c, out[i].d, \ - exp[i].a, exp[i].b, exp[i].c, exp[i].d, \ - i); \ - } - static void D3DXColorTest(void) { D3DXCOLOR color, color1, color2, expected, got; @@ -2449,8 +2437,16 @@ static void test_D3DXVec_Array(void) exp_plane[3].a = 74.0f; exp_plane[3].b = 84.0f; exp_plane[3].c = 94.0f; exp_plane[3].d = 104.0f; exp_plane[4].a = 66.0f; exp_plane[4].b = 76.0f; exp_plane[4].c = 86.0f; exp_plane[4].d = 96.0f; exp_plane[5].a = 58.0f; exp_plane[5].b = 68.0f; exp_plane[5].c = 78.0f; exp_plane[5].d = 88.0f; - D3DXPlaneTransformArray(out_plane + 1, sizeof(D3DXPLANE), inp_plane, sizeof(D3DXPLANE), &mat, ARRAY_SIZE); - compare_planes(exp_plane, out_plane); + D3DXPlaneTransformArray(&out_plane[1], sizeof(*out_plane), inp_plane, sizeof(*inp_plane), &mat, ARRAY_SIZE); + for (i = 0; i < ARRAY_SIZE + 2; ++i) + { + BOOL equal = compare_plane(&exp_plane[i], &out_plane[i], 0); + ok(equal, "Got unexpected plane {%.8e, %.8e, %.8e, %.8e} at index %u, expected {%.8e, %.8e, %.8e, %.8e}.\n", + out_plane[i].a, out_plane[i].b, out_plane[i].c, out_plane[i].d, i, + exp_plane[i].a, exp_plane[i].b, exp_plane[i].c, exp_plane[i].d); + if (!equal) + break; + } } static void test_D3DXFloat_Array(void)