Tiddify tests

This commit is contained in:
NukeBird 2025-02-16 20:43:08 +03:00
parent 74db6c8e60
commit 558a1f0299

View file

@ -262,10 +262,9 @@ TEST_CASE("Systems execute at correct frequencies")
}); });
// Simulate 2 seconds of updates at 120 FPS // Simulate 2 seconds of updates at 120 FPS
const float dt = 1.0f / 120.0f;
for (int i = 0; i < 240; ++i) for (int i = 0; i < 240; ++i)
{ {
scheduler.update(dt); scheduler.update(1.0f / 120.0f);
} }
// Verify counts // Verify counts
@ -287,10 +286,9 @@ TEST_CASE("Systems handle zero-frequency gracefully")
}); });
// Simulate 1 second of updates at 60 FPS // Simulate 1 second of updates at 60 FPS
const float dt = 1.0f / 60.0f;
for (int i = 0; i < 60; ++i) for (int i = 0; i < 60; ++i)
{ {
scheduler.update(dt); scheduler.update(1.0f / 60.0f);
} }
// Verify zero-frequency system never executes // Verify zero-frequency system never executes
@ -311,10 +309,9 @@ TEST_CASE("Systems handle varying update rates")
}); });
// Simulate 1 second of updates at 30 FPS // Simulate 1 second of updates at 30 FPS
const float dt = 1.0f / 30.0f;
for (int i = 0; i < 30; ++i) for (int i = 0; i < 30; ++i)
{ {
scheduler.update(dt); scheduler.update(1.0f / 30.0f);
} }
// Verify varying-frequency system executes 10 times // Verify varying-frequency system executes 10 times
@ -356,10 +353,9 @@ TEST_CASE("Systems handle multiple frequencies")
scheduler.add_system(1, [&](float dt) { slow_count++; }); scheduler.add_system(1, [&](float dt) { slow_count++; });
// Simulate 1 second of updates at 120 FPS // Simulate 1 second of updates at 120 FPS
const float dt = 1.0f / 120;
for (int i = 0; i < 120; ++i) for (int i = 0; i < 120; ++i)
{ {
scheduler.update(dt); scheduler.update(1.0f / 120.0f);
} }
// Verify counts // Verify counts
@ -382,10 +378,9 @@ TEST_CASE("Systems handle fractional frequencies")
}); });
// Simulate 4 seconds of updates at 60 FPS // Simulate 4 seconds of updates at 60 FPS
const float dt = 1.0f / 60;
for (int i = 0; i < 240; ++i) for (int i = 0; i < 240; ++i)
{ {
scheduler.update(dt); scheduler.update(1.0f / 60.0f);
} }
// Verify fractional-frequency system executes twice (0.5 Hz = 2 times in 4 seconds) // Verify fractional-frequency system executes twice (0.5 Hz = 2 times in 4 seconds)