2012/6/19 Nozomi Kodama nozomi.kodama@yahoo.com:
+static void test_D3DXSHDot(void) +{ + unsigned int i; + FLOAT a[90], b[90], got; + CONST FLOAT expected[] = + { 0.0f, 0.0f, 17.0f, 222.0f, 1300.0f, 5050.0f, 15225.0f, 38612.0f, 86352.0f, 175500.0f, }; + + for (i = 0; i < 90; i++) + { + a[i] = (FLOAT)i; + b[i] = (FLOAT)i + 0.5f; + } + +/* D3DXSHDot computes by using order * order elements */ + for (i = 0; i < 9; i++) + { + got = D3DXSHDot(i, a, b); + ok(relative_error(got, expected[i]) < admitted_error, "order %d: expected %f, received %f\n", i, expected[i], got); + } + + return; +} +
Making the "a" and "b" arrays 90 elements big doesn't make much sense. If your D3DXSHDot implementation is correct, for the i = 8 case you only need 8 * 8 = 64 elements. Also notice that the "expected" array has 10 elements, while you use only 9.
Also please recheck formatting and whitespaces of this patch and patch 2/2.