Skip to content

Commit 89479bb

Browse files
committed
Keyframe tests: Add test about large segment, including performance
This new test makes sure that a large segment is handled correctly and also with reasonable performance. The timeout of 10ms is still relatively slow (on a mid-class laptop it takes 0.001ms currently) but the test shouldn't fail when e.g. the build machine is under (mild to heavy) load.
1 parent c940c1f commit 89479bb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/KeyFrame_Tests.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,3 +482,15 @@ TEST(Keyframe_Use_Interpolation_of_Segment_End_Point)
482482
f.AddPoint(100,155, BEZIER);
483483
CHECK_CLOSE(75.9, f.GetValue(50), 0.1);
484484
}
485+
486+
TEST(Keyframe_Handle_Large_Segment)
487+
{
488+
Keyframe kf;
489+
kf.AddPoint(1, 0, CONSTANT);
490+
kf.AddPoint(1000000, 1, LINEAR);
491+
UNITTEST_TIME_CONSTRAINT(10); // 10 milliseconds would still be relatively slow, but need to think about slower build machines!
492+
CHECK_CLOSE(0.5, kf.GetValue(500000), 0.01);
493+
CHECK_EQUAL(true, kf.IsIncreasing(10));
494+
Fraction fr = kf.GetRepeatFraction(250000);
495+
CHECK_CLOSE(0.5, (double)fr.num / fr.den, 0.01);
496+
}

0 commit comments

Comments
 (0)