mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 07:17:42 -05:00
Fix sub-optimal uses of is_equal_approx
This commit is contained in:
@@ -278,24 +278,24 @@ TEST_CASE("[AABB] Get endpoints") {
|
||||
TEST_CASE("[AABB] Get longest/shortest axis") {
|
||||
const AABB aabb = AABB(Vector3(-1.5, 2, -2.5), Vector3(4, 5, 6));
|
||||
CHECK_MESSAGE(
|
||||
aabb.get_longest_axis().is_equal_approx(Vector3(0, 0, 1)),
|
||||
aabb.get_longest_axis() == Vector3(0, 0, 1),
|
||||
"get_longest_axis() should return the expected value.");
|
||||
CHECK_MESSAGE(
|
||||
aabb.get_longest_axis_index() == Vector3::AXIS_Z,
|
||||
"get_longest_axis() should return the expected value.");
|
||||
"get_longest_axis_index() should return the expected value.");
|
||||
CHECK_MESSAGE(
|
||||
Math::is_equal_approx(aabb.get_longest_axis_size(), 6),
|
||||
"get_longest_axis() should return the expected value.");
|
||||
aabb.get_longest_axis_size() == 6,
|
||||
"get_longest_axis_size() should return the expected value.");
|
||||
|
||||
CHECK_MESSAGE(
|
||||
aabb.get_shortest_axis().is_equal_approx(Vector3(1, 0, 0)),
|
||||
aabb.get_shortest_axis() == Vector3(1, 0, 0),
|
||||
"get_shortest_axis() should return the expected value.");
|
||||
CHECK_MESSAGE(
|
||||
aabb.get_shortest_axis_index() == Vector3::AXIS_X,
|
||||
"get_shortest_axis() should return the expected value.");
|
||||
"get_shortest_axis_index() should return the expected value.");
|
||||
CHECK_MESSAGE(
|
||||
Math::is_equal_approx(aabb.get_shortest_axis_size(), 4),
|
||||
"get_shortest_axis() should return the expected value.");
|
||||
aabb.get_shortest_axis_size() == 4,
|
||||
"get_shortest_axis_size() should return the expected value.");
|
||||
}
|
||||
|
||||
#ifndef _MSC_VER
|
||||
|
||||
@@ -80,7 +80,7 @@ TEST_CASE("[Curve] Custom curve with free tangents") {
|
||||
"Custom free curve should contain the expected number of points.");
|
||||
|
||||
CHECK_MESSAGE(
|
||||
Math::is_equal_approx(curve->interpolate(-0.1), 0),
|
||||
Math::is_zero_approx(curve->interpolate(-0.1)),
|
||||
"Custom free curve should return the expected value at offset 0.1.");
|
||||
CHECK_MESSAGE(
|
||||
Math::is_equal_approx(curve->interpolate(0.1), (real_t)0.352),
|
||||
@@ -99,7 +99,7 @@ TEST_CASE("[Curve] Custom curve with free tangents") {
|
||||
"Custom free curve should return the expected value at offset 0.1.");
|
||||
|
||||
CHECK_MESSAGE(
|
||||
Math::is_equal_approx(curve->interpolate_baked(-0.1), 0),
|
||||
Math::is_zero_approx(curve->interpolate_baked(-0.1)),
|
||||
"Custom free curve should return the expected baked value at offset 0.1.");
|
||||
CHECK_MESSAGE(
|
||||
Math::is_equal_approx(curve->interpolate_baked(0.1), (real_t)0.352),
|
||||
@@ -169,7 +169,7 @@ TEST_CASE("[Curve] Custom curve with linear tangents") {
|
||||
"Custom linear curve should contain the expected number of points.");
|
||||
|
||||
CHECK_MESSAGE(
|
||||
Math::is_equal_approx(curve->interpolate(-0.1), 0),
|
||||
Math::is_zero_approx(curve->interpolate(-0.1)),
|
||||
"Custom linear curve should return the expected value at offset -0.1.");
|
||||
CHECK_MESSAGE(
|
||||
Math::is_equal_approx(curve->interpolate(0.1), (real_t)0.4),
|
||||
@@ -188,7 +188,7 @@ TEST_CASE("[Curve] Custom curve with linear tangents") {
|
||||
"Custom linear curve should return the expected value at offset 2.0.");
|
||||
|
||||
CHECK_MESSAGE(
|
||||
Math::is_equal_approx(curve->interpolate_baked(-0.1), 0),
|
||||
Math::is_zero_approx(curve->interpolate_baked(-0.1)),
|
||||
"Custom linear curve should return the expected baked value at offset -0.1.");
|
||||
CHECK_MESSAGE(
|
||||
Math::is_equal_approx(curve->interpolate_baked(0.1), (real_t)0.4),
|
||||
|
||||
@@ -83,7 +83,7 @@ TEST_CASE("[JSON] Parsing single data types") {
|
||||
json.get_error_line() == 0,
|
||||
"Parsing a floating-point number as JSON should parse successfully.");
|
||||
CHECK_MESSAGE(
|
||||
Math::is_equal_approx(json.get_data(), 0.123456),
|
||||
Math::is_equal_approx(double(json.get_data()), 0.123456),
|
||||
"Parsing a floating-point number as JSON should return the expected value.");
|
||||
|
||||
json.parse("\"hello\"");
|
||||
|
||||
Reference in New Issue
Block a user