mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
mat4 test case fixes.
The tests cases themselves were buggy.
This commit is contained in:
parent
89daf15215
commit
575a67b2a1
1 changed files with 22 additions and 10 deletions
|
@ -58,8 +58,8 @@ static vec3_t test_scales[] = {
|
||||||
{ 3, 1, 2},
|
{ 3, 1, 2},
|
||||||
{ 3, 2, 1},
|
{ 3, 2, 1},
|
||||||
};
|
};
|
||||||
#define num_translation_tests \
|
#define num_scale_tests \
|
||||||
(sizeof (test_translations) / sizeof (test_translations[0]))
|
(sizeof (test_scales) / sizeof (test_scales[0]))
|
||||||
|
|
||||||
// return true if a and b are close enough (yay, floats)
|
// return true if a and b are close enough (yay, floats)
|
||||||
static int
|
static int
|
||||||
|
@ -143,7 +143,8 @@ test_transform2 (const vec3_t angles, const vec3_t scale,
|
||||||
vec3_t x, y;
|
vec3_t x, y;
|
||||||
quat_t rotation;
|
quat_t rotation;
|
||||||
mat4_t mat;
|
mat4_t mat;
|
||||||
vec3_t rot, sc, sh, tr;
|
quat_t rot;
|
||||||
|
vec3_t sc, sh, tr;
|
||||||
|
|
||||||
VectorCopy (v, x);
|
VectorCopy (v, x);
|
||||||
AngleQuat (angles, rotation);
|
AngleQuat (angles, rotation);
|
||||||
|
@ -171,6 +172,9 @@ fail:
|
||||||
VectorExpand (translation), VectorExpand (v));
|
VectorExpand (translation), VectorExpand (v));
|
||||||
printf (" (%g %g %g)\n", VectorExpand (x));
|
printf (" (%g %g %g)\n", VectorExpand (x));
|
||||||
printf (" (%g %g %g)\n", VectorExpand (y));
|
printf (" (%g %g %g)\n", VectorExpand (y));
|
||||||
|
printf (" (%g %g %g %g) (%g %g %g %g) (%g %g %g) (%g %g %g) (%g %g %g)\n",
|
||||||
|
QuatExpand (rotation), QuatExpand (rot), VectorExpand (sh),
|
||||||
|
VectorExpand (sc), VectorExpand (tr));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,33 +218,41 @@ main (int argc, const char **argv)
|
||||||
size_t i, j, k;
|
size_t i, j, k;
|
||||||
|
|
||||||
for (i = 0; i < num_angle_tests; i ++) {
|
for (i = 0; i < num_angle_tests; i ++) {
|
||||||
if (!test_angle (test_angles[i]))
|
if (!test_angle (test_angles[i])) {
|
||||||
res = 1;
|
res = 1;
|
||||||
|
printf("angle test %zd failed\n", i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < num_angle_tests; i ++) {
|
for (i = 0; i < num_angle_tests; i ++) {
|
||||||
for (j = 0; j < num_translation_tests; j ++) {
|
for (j = 0; j < num_scale_tests; j ++) {
|
||||||
for (k = 0; k < num_translation_tests; k ++) {
|
for (k = 0; k < num_translation_tests; k ++) {
|
||||||
if (!test_transform (test_angles[i], test_scales[j],
|
if (!test_transform (test_angles[i], test_scales[j],
|
||||||
test_translations[k]))
|
test_translations[k])) {
|
||||||
res = 1;
|
res = 1;
|
||||||
|
printf("transform test %zd:%zd:%zd failed\n", i, j, k);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < num_angle_tests; i ++) {
|
for (i = 0; i < num_angle_tests; i ++) {
|
||||||
for (j = 0; j < num_translation_tests; j ++) {
|
for (j = 0; j < num_scale_tests; j ++) {
|
||||||
for (k = 0; k < num_translation_tests; k ++) {
|
for (k = 0; k < num_translation_tests; k ++) {
|
||||||
if (!test_transform2 (test_angles[i], test_scales[j],
|
if (!test_transform2 (test_angles[i], test_scales[j],
|
||||||
test_translations[k]))
|
test_translations[k])) {
|
||||||
res = 1;
|
res = 1;
|
||||||
|
printf("transform2 test %zd:%zd:%zd failed\n", i, j, k);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < num_angle_tests; i ++) {
|
for (i = 0; i < num_angle_tests; i ++) {
|
||||||
for (j = 0; j < num_translation_tests; j ++) {
|
for (j = 0; j < num_scale_tests; j ++) {
|
||||||
for (k = 0; k < num_translation_tests; k ++) {
|
for (k = 0; k < num_translation_tests; k ++) {
|
||||||
if (!test_inverse (test_angles[i], test_scales[j],
|
if (!test_inverse (test_angles[i], test_scales[j],
|
||||||
test_translations[k]))
|
test_translations[k])) {
|
||||||
res = 1;
|
res = 1;
|
||||||
|
printf("inverse test %zd:%zd:%zd failed\n", i, j, k);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue