d3dx9/tests: Use compare_float() in test_D3DXSHRotateZ().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2017-05-04 12:06:03 +02:00 committed by Alexandre Julliard
parent c48dd628c5
commit 10db51d5c2

View file

@ -3457,72 +3457,77 @@ static void test_D3DXSHRotate(void)
static void test_D3DXSHRotateZ(void)
{
float expected, in[49], out[49], *out_temp, *received_ptr;
unsigned int end, i, j, l, order, square;
FLOAT expected, in[49], out[49], *out_temp, *received_ptr;
const FLOAT angle[] = { D3DX_PI / 3.0f, -D3DX_PI / 3.0f, 4.0f * D3DX_PI / 3.0f, }, table[] =
{ /* Angle = D3DX_PI / 3.0f */
1.01f, 4.477762f, 3.010000f, 0.264289f, 5.297888f, 9.941864f,
7.010000f, -1.199813f, -8.843789f, -10.010002f, 7.494040f, 18.138016f,
13.010000, -3.395966f, -17.039942f, -16.009998f, -30.164297f, -18.010004f,
10.422242f, 29.066219f, 21.010000f, -6.324171f, -27.968145f, -24.009998f,
2.226099f, -18.180565, -43.824551f, -28.010004f, 14.082493f, 42.726471f,
31.010000f, -9.984426f, -41.628399f, -34.009995f, 5.886358f, 40.530331f,
BOOL equal;
1.01f, 4.477762f, 0.0f, -5.816784f, 5.297888f, 6.936864f,
0.0f, -9.011250f, -2.294052f, -10.010002f, 12.999042f, 12.133017f,
0.0f, -15.761250f, -5.628748f, 0.0f, -30.164297f, 0.0f,
19.927244f, 19.061220f, 0.0f, -24.761251f, -8.628748f, 0.0f,
-13.061530f, -18.180565f, -30.319553f, 0.0f, 28.587496f, 27.721474f,
0.0f, -36.011253f, -12.378746f, 0.0f, -13.128758f, -23.617250f,
static const float angle[] = {D3DX_PI / 3.0f, -D3DX_PI / 3.0f, 4.0f * D3DX_PI / 3.0f};
static const float table[] =
{
/* Angle π/3. */
1.00999999e+00f, 4.47776222e+00f, 3.00999999e+00f, 2.64288902e-01f, 5.29788828e+00f, 9.94186401e+00f,
7.01000023e+00f, -1.19981313e+00f, -8.84378910e+00f, -1.00100021e+01f, 7.49403954e+00f, 1.81380157e+01f,
1.30100002e+01f, -3.39596605e+00f, -1.70399418e+01f, -1.60099983e+01f, -3.01642971e+01f, -1.80100040e+01f,
1.04222422e+01f, 2.90662193e+01f, 2.10100002e+01f, -6.32417059e+00f, -2.79681454e+01f, -2.40099983e+01f,
2.22609901e+00f, -1.81805649e+01f, -4.38245506e+01f, -2.80100040e+01f, 1.40824928e+01f, 4.27264709e+01f,
3.10100002e+01f, -9.98442554e+00f, -4.16283989e+01f, -3.40099945e+01f, 5.88635778e+00f, 4.05303307e+01f,
1.010000f, 3.977762f, 3.977762f, 1.114195f, 7.245791f, 10.559759f,
10.559759f, -0.995160f, -0.467341f, 0.467339f, 12.765371f, 18.515701f,
18.515701f, -1.797287f, 0.493916f, -0.493916f, -21.412342f, 21.412338f,
9.221072f, 23.671757f, 23.671757f, 3.850195f, -20.468727f, 20.468723f,
-10.662103f, -36.516628f, -12.061245f, 12.061240f, 22.556875f, 38.999908f,
38.999908f, -0.034875f, -10.427902f, 10.427900f, -36.838284f, -27.652803f,
/* Angle = -D3DX_PI / 3.0f */
1.01f, -2.467762f, 3.010000f, 3.745711f, -10.307890f, -3.931864f,
7.010000f, 9.209813f, -0.166214f, -10.010002f, -18.504044f, -6.128017f,
13.010000f, 17.405966f, 2.029938f, -16.009998f, 13.154303f, -18.010004f,
-29.432247f, -9.056221f, 21.010000f, 28.334169f, 4.958139f, -24.010002f,
-27.236092f, 44.190582f, 16.814558f, -28.009996f, -43.092499f, -12.716474f,
31.010000f, 41.994423f, 8.618393f, -34.010002f, -40.896347f, -4.520310f,
1.00999999e+00f, 4.47776222e+00f, 0.00000000e+00f, -5.81678391e+00f, 5.29788828e+00f, 6.93686390e+00f,
0.00000000e+00f, -9.01125050e+00f, -2.29405236e+00f, -1.00100021e+01f, 1.29990416e+01f, 1.21330166e+01f,
0.00000000e+00f, -1.57612505e+01f, -5.62874842e+00f, 0.00000000e+00f, -3.01642971e+01f, -3.29017075e-06f,
1.99272442e+01f, 1.90612202e+01f, 0.00000000e+00f, -2.47612514e+01f, -8.62874794e+00f, 0.00000000e+00f,
-1.30615301e+01f, -1.81805649e+01f, -3.03195534e+01f, -4.66050415e-06f, 2.85874958e+01f, 2.77214737e+01f,
0.00000000e+00f, -3.60112534e+01f, -1.23787460e+01f, 0.00000000e+00f, -1.31287584e+01f, -2.36172504e+01f,
1.01f, -2.467762f, 0.0f, -3.205718f, -10.307890f, -6.936864f,
0.0f, -9.011250f, -4.463446f, -10.009998f, -12.999042f, -12.133017f,
0.0f, -15.761250f, -5.628748f, 0.0f, 13.154303f, 0.0f,
-19.927244f, -19.061220f, 0.0f, -24.761251f, -8.628748f, 0.0f,
-5.695983f, 44.190582f, 30.319553f, 0.0f, -28.587496f, -27.721474f,
0.0f, -36.011253f, -12.378746f, 0.0f, -13.128758f, -57.405258f,
1.00999999e+00f, 3.97776222e+00f, 3.97776222e+00f, 1.11419535e+00f, 7.24579096e+00f, 1.05597591e+01f,
1.05597591e+01f, -9.95159924e-01f, -4.67341393e-01f, 4.67339337e-01f, 1.27653713e+01f, 1.85157013e+01f,
1.85157013e+01f, -1.79728663e+00f, 4.93915796e-01f, -4.93915856e-01f, -2.14123421e+01f, 2.14123383e+01f,
9.22107220e+00f, 2.36717567e+01f, 2.36717567e+01f, 3.85019469e+00f, -2.04687271e+01f, 2.04687233e+01f,
-1.06621027e+01f, -3.65166283e+01f, -1.20612450e+01f, 1.20612402e+01f, 2.25568752e+01f, 3.89999084e+01f,
3.89999084e+01f, -3.48751247e-02f, -1.04279022e+01f, 1.04279003e+01f, -3.68382835e+01f, -2.76528034e+01f,
/* Angle -π/3. */
1.00999999e+00f, -2.46776247e+00f, 3.00999999e+00f, 3.74571109e+00f, -1.03078899e+01f, -3.93186426e+00f,
7.01000023e+00f, 9.20981312e+00f, -1.66213632e-01f, -1.00099983e+01f, -1.85040436e+01f, -6.12801695e+00f,
1.30100002e+01f, 1.74059658e+01f, 2.02993774e+00f, -1.60100021e+01f, 1.31543026e+01f, -1.80099964e+01f,
-2.94322472e+01f, -9.05622101e+00f, 2.10100002e+01f, 2.83341694e+01f, 4.95813942e+00f, -2.40100021e+01f,
-2.72360916e+01f, 4.41905823e+01f, 1.68145580e+01f, -2.80099964e+01f, -4.30924988e+01f, -1.27164736e+01f,
3.10100002e+01f, 4.19944229e+01f, 8.61839294e+00f, -3.40100021e+01f, -4.08963470e+01f, -4.52030993e+00f,
1.010000f, -2.967762f, -2.967762f, -0.609195f, -7.498291f, -10.686009f,
-10.686009f, -11.836716f, 5.390780f, -5.390779f, -10.303651f, -17.284842f,
-17.284842f, -17.565643f, 4.114273f, -4.114273f, 23.716436f, -23.716433f,
-8.069025f, -23.095732f, -23.095732f, -18.535847f, -11.271107f, 11.271104f,
-2.072484f, 30.149330f, 15.244893f, -15.244888f, -20.965050f, -38.203999f,
-38.203999f, -37.258266f, 5.426677f, -5.426679f, -23.396751f, -9.903559f,
/* Angle = 4.0f * D3DX_PI / 3.0f */
1.01f, -4.477762f, 3.010000f, -0.264289f, 5.297887f, -9.941864f,
7.010000f, 1.199814f, -8.843788f, 10.010004f, 7.494038f, -18.138016f,
13.010000f, 3.395967f, -17.039940f, 16.009996f, -30.164293f, 18.010006f,
10.422239f, -29.066219f, 21.010000f, 6.324172f, -27.968143f, 24.009993f,
2.226105f, 18.180552f, -43.824543f, 28.010008f, 14.082489f, -42.726471f,
31.010000f, 9.984427f, -41.628399f, 34.009987f, 5.886366f, -40.530327f,
1.00999999e+00f, -2.46776247e+00f, 0.00000000e+00f, -3.20571756e+00f, -1.03078899e+01f, -6.93686390e+00f,
0.00000000e+00f, -9.01125050e+00f, -4.46344614e+00f, -1.00099983e+01f, -1.29990416e+01f, -1.21330166e+01f,
0.00000000e+00f, -1.57612505e+01f, -5.62874842e+00f, 0.00000000e+00f, 1.31543026e+01f, 3.29017075e-06f,
-1.99272442e+01f, -1.90612202e+01f, 0.00000000e+00f, -2.47612514e+01f, -8.62874794e+00f, 0.00000000e+00f,
-5.69598293e+00f, 4.41905823e+01f, 3.03195534e+01f, 4.66050415e-06f, -2.85874958e+01f, -2.77214737e+01f,
0.00000000e+00f, -3.60112534e+01f, -1.23787460e+01f, 0.00000000e+00f, -1.31287584e+01f, -5.74052582e+01f,
1.01f, -4.477762f, 0.0f, -1.938928f, 5.297887f, -6.936864f,
0.0f, -3.003751f, -2.294051f, 10.010004f, 12.999040f, -12.133017f,
0.0f, -5.253751f, -5.628747f, 0.0f, -30.164293f, 0.0f,
19.927242f, -19.061220f, 0.0f, -8.253753f, -8.628746f, 0.0f,
-13.061535f, 18.180552f, -30.319553f, 0.0f, 28.587492f, -27.721474f,
0.0f, -12.003753f, -12.378742f, 0.0f, -13.128765f, -7.872400f,
1.00999999e+00f, -2.96776223e+00f, -2.96776223e+00f, -6.09195352e-01f, -7.49829102e+00f, -1.06860094e+01f,
-1.06860094e+01f, -1.18367157e+01f, 5.39078045e+00f, -5.39077854e+00f, -1.03036509e+01f, -1.72848415e+01f,
-1.72848415e+01f, -1.75656433e+01f, 4.11427259e+00f, -4.11427307e+00f, 2.37164364e+01f, -2.37164326e+01f,
-8.06902504e+00f, -2.30957317e+01f, -2.30957317e+01f, -1.85358467e+01f, -1.12711067e+01f, 1.12711039e+01f,
-2.07248449e+00f, 3.01493301e+01f, 1.52448931e+01f, -1.52448883e+01f, -2.09650497e+01f, -3.82039986e+01f,
-3.82039986e+01f, -3.72582664e+01f, 5.42667723e+00f, -5.42667913e+00f, -2.33967514e+01f, -9.90355873e+00f,
/* Angle 4π/3. */
1.00999999e+00f, -4.47776222e+00f, 3.00999999e+00f, -2.64288664e-01f, 5.29788685e+00f, -9.94186401e+00f,
7.01000023e+00f, 1.19981360e+00f, -8.84378815e+00f, 1.00100040e+01f, 7.49403811e+00f, -1.81380157e+01f,
1.30100002e+01f, 3.39596677e+00f, -1.70399399e+01f, 1.60099964e+01f, -3.01642933e+01f, 1.80100060e+01f,
1.04222393e+01f, -2.90662193e+01f, 2.10100002e+01f, 6.32417202e+00f, -2.79681435e+01f, 2.40099926e+01f,
2.22610497e+00f, 1.81805515e+01f, -4.38245430e+01f, 2.80100079e+01f, 1.40824890e+01f, -4.27264709e+01f,
3.10100002e+01f, 9.98442745e+00f, -4.16283989e+01f, 3.40099869e+01f, 5.88636589e+00f, -4.05303268e+01f,
1.010000f, -3.977762f, -3.977762f, 2.863566f, 6.371104f, -10.122416f,
-10.122416f, 10.578746f, -7.769295f, -7.769290f, 16.883686f, -20.574858f,
-20.574858f, 24.909130f, -5.726166f, -5.726164f, -18.796221f, -18.796211f,
29.325350f, -33.723892f, -33.723892f, 42.258442f, -4.851232f, -4.851226f,
-2.533393f, 32.452259f, -46.545670f, -46.545654f, 51.860325f, -53.651630f,
-53.651630f, 71.738174f, 4.440616f, 4.440629f, 25.884174f, -10.748116f, };
1.00999999e+00f, -4.47776222e+00f, 0.00000000e+00f, -1.93892837e+00f, 5.29788685e+00f, -6.93686390e+00f,
0.00000000e+00f, -3.00375080e+00f, -2.29405141e+00f, 1.00100040e+01f, 1.29990396e+01f, -1.21330166e+01f,
0.00000000e+00f, -5.25375128e+00f, -5.62874699e+00f, -5.68378528e-06f, -3.01642933e+01f, 7.00829787e-06f,
1.99272423e+01f, -1.90612202e+01f, 0.00000000e+00f, -8.25375271e+00f, -8.62874603e+00f, -4.09131496e-12f,
-1.30615349e+01f, 1.81805515e+01f, -3.03195534e+01f, 9.92720470e-06f, 2.85874920e+01f, -2.77214737e+01f,
0.00000000e+00f, -1.20037527e+01f, -1.23787422e+01f, -5.79531909e-12f, -1.31287651e+01f, -7.87240028e+00f,
1.00999999e+00f, -3.97776222e+00f, -3.97776222e+00f, 2.86356640e+00f, 6.37110424e+00f, -1.01224155e+01f,
-1.01224155e+01f, 1.05787458e+01f, -7.76929522e+00f, -7.76928997e+00f, 1.68836861e+01f, -2.05748577e+01f,
-2.05748577e+01f, 2.49091301e+01f, -5.72616625e+00f, -5.72616386e+00f, -1.87962208e+01f, -1.87962112e+01f,
2.93253498e+01f, -3.37238922e+01f, -3.37238922e+01f, 4.22584419e+01f, -4.85123205e+00f, -4.85122633e+00f,
-2.53339314e+00f, 3.24522591e+01f, -4.65456696e+01f, -4.65456543e+01f, 5.18603249e+01f, -5.36516304e+01f,
-5.36516304e+01f, 7.17381744e+01f, 4.44061565e+00f, 4.44062901e+00f, 2.58841743e+01f, -1.07481155e+01f,
};
for (l = 0; l < 3; l++)
{
@ -3560,7 +3565,10 @@ static void test_D3DXSHRotateZ(void)
expected = ( i + 1.0f ) * ( i + 1.0f );
else
expected = table[36 * (l + 3 * j) + i];
ok(relative_error(expected, out_temp[i]) < admitted_error, "angle %f, order %u index %u, expected %f, received %f\n", angle[j], order, i, expected, out_temp[i]);
equal = compare_float(expected, out_temp[i], 256);
ok(equal || (fabs(expected) < 2.0e-5f && fabs(out_temp[i]) < 2.0e-5f),
"angle %.8e, order %u index %u, expected %.8e, received %.8e.\n",
angle[j], order, i, expected, out_temp[i]);
}
}
}