summaryrefslogtreecommitdiff
path: root/indra/llmath/tests
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-11-02 20:55:56 +0800
committerErik Kundiman <erik@megapahit.org>2024-11-03 19:33:18 +0800
commit3f72f9a202bed628f838cc24fe58a0511ca0d161 (patch)
tree0684cfff91551d9b6aabdb825981b46a5cb53fe8 /indra/llmath/tests
parentd302bf3c96666cfd46d7585cb3d8b6ec27bb83bf (diff)
parent9c0a6d1b0e5e9d6da6a63ff367f40ab08c064bbe (diff)
Merge remote-tracking branch 'secondlife/release/maint-c' into maint-c
Diffstat (limited to 'indra/llmath/tests')
-rw-r--r--indra/llmath/tests/mathmisc_test.cpp32
-rw-r--r--indra/llmath/tests/v3dmath_test.cpp13
2 files changed, 28 insertions, 17 deletions
diff --git a/indra/llmath/tests/mathmisc_test.cpp b/indra/llmath/tests/mathmisc_test.cpp
index ff0899e975..2b23987616 100644
--- a/indra/llmath/tests/mathmisc_test.cpp
+++ b/indra/llmath/tests/mathmisc_test.cpp
@@ -709,14 +709,34 @@ namespace tut
first_plane,
second_plane);
- ensure("plane intersection should succeed", success);
+ try
+ {
+ ensure("plane intersection should succeed", success);
- F32 dot = fabs(known_intersection.getDirection() * measured_intersection.getDirection());
- ensure("measured intersection should be parallel to known intersection",
- dot > ALMOST_PARALLEL);
+ F32 dot = fabs(known_intersection.getDirection() * measured_intersection.getDirection());
+ ensure("measured intersection should be parallel to known intersection",
+ dot > ALMOST_PARALLEL);
- ensure("measured intersection should pass near known point",
- measured_intersection.intersects(some_point, LARGE_RADIUS * allowable_relative_error));
+ ensure("measured intersection should pass near known point",
+ measured_intersection.intersects(some_point, LARGE_RADIUS * allowable_relative_error));
+ }
+ catch (const failure&)
+ {
+ // If any of these assertions fail, since the values involved
+ // are randomly generated, unless we report them, we have no
+ // hope of diagnosing the problem.
+ LL_INFOS() << "some_point = " << some_point << '\n'
+ << "another_point = " << another_point << '\n'
+ << "known_intersection = " << known_intersection << '\n'
+ << "point_on_plane = " << point_on_plane << '\n'
+ << "plane_normal = " << plane_normal << '\n'
+ << "first_plane = " << first_plane << '\n'
+ << "point_on_different_plane = " << point_on_different_plane << '\n'
+ << "different_plane_normal = " << different_plane_normal << '\n'
+ << "second_plane = " << second_plane << '\n'
+ << "measured_intersection = " << measured_intersection << LL_ENDL;
+ throw;
+ }
}
}
}
diff --git a/indra/llmath/tests/v3dmath_test.cpp b/indra/llmath/tests/v3dmath_test.cpp
index db08419012..36ad1067a2 100644
--- a/indra/llmath/tests/v3dmath_test.cpp
+++ b/indra/llmath/tests/v3dmath_test.cpp
@@ -504,14 +504,11 @@ namespace tut
template<> template<>
void v3dmath_object::test<24>()
{
-#if LL_WINDOWS && _MSC_VER < 1400
- skip("This fails on VS2003!");
-#else
F64 x = 10., y = 20., z = -15.;
F64 angle1, angle2;
LLVector3d vec3Da(x,y,z), vec3Db(x,y,z);
angle1 = angle_between(vec3Da, vec3Db);
- ensure("1:angle_between: Fail ", (0 == angle1));
+ ensure_approximately_equals_range("1:angle_between: Fail ", angle1, 0., 1.5e-8);
F64 x1 = -1., y1 = -20., z1 = -1.;
vec3Da.clearVec();
vec3Da.setVec(x1,y1,z1);
@@ -520,12 +517,6 @@ namespace tut
vec3Da.normVec();
F64 angle = vec3Db*vec3Da;
angle = acos(angle);
-#if LL_WINDOWS && _MSC_VER > 1900
- skip("This fails on VS2017!");
-#else
- ensure("2:angle_between: Fail ", (angle == angle2));
-#endif
-
-#endif
+ ensure_equals("2:angle_between: Fail ", angle, angle2);
}
}