aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/LoopTimerTest.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/test/LoopTimerTest.cpp b/src/test/LoopTimerTest.cpp
index e4f8477..5e1eccf 100644
--- a/src/test/LoopTimerTest.cpp
+++ b/src/test/LoopTimerTest.cpp
@@ -15,6 +15,7 @@ protected:
void SetUp() override { loop_timer.start(); }
};
+
TEST_F(LoopTimerTest, EnforcesTargetFrameRate) {
// Set the target FPS to 60 (which gives a target time per frame of ~16.67 ms)
loop_timer.set_target_framerate(60);
@@ -28,15 +29,17 @@ TEST_F(LoopTimerTest, EnforcesTargetFrameRate) {
// For 60 FPS, the target frame time is around 16.67ms
ASSERT_NEAR(elapsed_ms, 16.7, 1);
}
+
TEST_F(LoopTimerTest, SetTargetFps) {
// Set the target FPS to 120
loop_timer.set_target_framerate(120);
// Calculate the expected frame time (~8.33ms per frame)
- Duration_t expected_frame_time = std::chrono::duration<float>(1.0 / 120.0);
+ duration_t expected_frame_time = std::chrono::duration<float>(1.0 / 120.0);
ASSERT_NEAR(loop_timer.frame_target_time.count(), expected_frame_time.count(), 0.001);
}
+
TEST_F(LoopTimerTest, DeltaTimeCalculation) {
// Set the target FPS to 60 (16.67 ms per frame)
loop_timer.set_target_framerate(60);
@@ -46,7 +49,7 @@ TEST_F(LoopTimerTest, DeltaTimeCalculation) {
auto end_time = steady_clock::now();
// Check the delta time
- Duration_t delta_time = loop_timer.get_delta_time();
+ duration_t delta_time = loop_timer.get_delta_time();
auto elapsed_time = duration_cast<seconds>(end_time - start_time).count();
@@ -69,7 +72,7 @@ TEST_F(LoopTimerTest, getCurrentTime) {
// Get the elapsed time in seconds as a double
auto elapsed_time
- = std::chrono::duration_cast<ElapsedTime_t>(end_time - start_time).count();
+ = std::chrono::duration_cast<elapsed_time_t>(end_time - start_time).count();
ASSERT_NEAR(loop_timer.get_elapsed_time().count(), elapsed_time, 5);
}