summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAaron Franke <arnfranke@yahoo.com>2021-10-15 15:32:26 -0500
committerAaron Franke <arnfranke@yahoo.com>2021-11-30 14:24:27 -0600
commit129911f61af35fa2aed03349368f7e94772b682e (patch)
tree04b8bdb78103816b2efcbeef879100ddd22f544e /tests
parente223a9c12905b99bb1fe93a56ae634b34eadd359 (diff)
Improve Curve with const and real_t
Diffstat (limited to 'tests')
-rw-r--r--tests/scene/test_curve.h26
1 files changed, 12 insertions, 14 deletions
diff --git a/tests/scene/test_curve.h b/tests/scene/test_curve.h
index 60eafad460..4ee1a1c15c 100644
--- a/tests/scene/test_curve.h
+++ b/tests/scene/test_curve.h
@@ -219,35 +219,33 @@ TEST_CASE("[Curve] Custom curve with linear tangents") {
TEST_CASE("[Curve2D] Linear sampling should return exact value") {
Ref<Curve2D> curve = memnew(Curve2D);
- int len = 2048;
+ real_t len = 2048.0;
curve->add_point(Vector2(0, 0));
- curve->add_point(Vector2((float)len, 0));
+ curve->add_point(Vector2(len, 0));
- float baked_length = curve->get_baked_length();
- CHECK((float)len == baked_length);
+ real_t baked_length = curve->get_baked_length();
+ CHECK(len == baked_length);
for (int i = 0; i < len; i++) {
- float expected = (float)i;
- Vector2 pos = curve->interpolate_baked(expected);
- CHECK_MESSAGE(pos.x == expected, "interpolate_baked should return exact value");
+ Vector2 pos = curve->interpolate_baked(i);
+ CHECK_MESSAGE(pos.x == i, "interpolate_baked should return exact value");
}
}
TEST_CASE("[Curve3D] Linear sampling should return exact value") {
Ref<Curve3D> curve = memnew(Curve3D);
- int len = 2048;
+ real_t len = 2048.0;
curve->add_point(Vector3(0, 0, 0));
- curve->add_point(Vector3((float)len, 0, 0));
+ curve->add_point(Vector3(len, 0, 0));
- float baked_length = curve->get_baked_length();
- CHECK((float)len == baked_length);
+ real_t baked_length = curve->get_baked_length();
+ CHECK(len == baked_length);
for (int i = 0; i < len; i++) {
- float expected = (float)i;
- Vector3 pos = curve->interpolate_baked(expected);
- CHECK_MESSAGE(pos.x == expected, "interpolate_baked should return exact value");
+ Vector3 pos = curve->interpolate_baked(i);
+ CHECK_MESSAGE(pos.x == i, "interpolate_baked should return exact value");
}
}