Format
This commit is contained in:
parent
6efb8c070b
commit
74db6c8e60
1 changed files with 26 additions and 13 deletions
|
@ -250,18 +250,21 @@ TEST_CASE("Systems execute at correct frequencies")
|
|||
int slow_count = 0;
|
||||
|
||||
// Add a fast system (60 Hz)
|
||||
scheduler.add_system(60, [&](float dt) {
|
||||
scheduler.add_system(60, [&](float dt)
|
||||
{
|
||||
fast_count++;
|
||||
});
|
||||
|
||||
// Add a slow system (1 Hz)
|
||||
scheduler.add_system(1, [&](float dt) {
|
||||
scheduler.add_system(1, [&](float dt)
|
||||
{
|
||||
slow_count++;
|
||||
});
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -278,13 +281,15 @@ TEST_CASE("Systems handle zero-frequency gracefully")
|
|||
int zero_count = 0;
|
||||
|
||||
// Add a zero-frequency system (should never execute)
|
||||
scheduler.add_system(0, [&](float dt) {
|
||||
scheduler.add_system(0, [&](float dt)
|
||||
{
|
||||
zero_count++;
|
||||
});
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -300,13 +305,15 @@ TEST_CASE("Systems handle varying update rates")
|
|||
int varying_count = 0;
|
||||
|
||||
// Add a system with varying frequency (10 Hz)
|
||||
scheduler.add_system(10, [&](float dt) {
|
||||
scheduler.add_system(10, [&](float dt)
|
||||
{
|
||||
varying_count++;
|
||||
});
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -322,7 +329,8 @@ TEST_CASE("Systems handle large time steps")
|
|||
int large_step_count = 0;
|
||||
|
||||
// Add a system (1 Hz)
|
||||
scheduler.add_system(1, [&](float dt) {
|
||||
scheduler.add_system(1, [&](float dt)
|
||||
{
|
||||
large_step_count++;
|
||||
});
|
||||
|
||||
|
@ -349,7 +357,8 @@ TEST_CASE("Systems handle multiple frequencies")
|
|||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -367,13 +376,15 @@ TEST_CASE("Systems handle fractional frequencies")
|
|||
int fractional_count = 0;
|
||||
|
||||
// Add a system with fractional frequency (0.5 Hz)
|
||||
scheduler.add_system(0.5f, [&](float dt) {
|
||||
scheduler.add_system(0.5f, [&](float dt)
|
||||
{
|
||||
fractional_count++;
|
||||
});
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -389,7 +400,8 @@ TEST_CASE("Systems handle zero delta time")
|
|||
int zero_dt_count = 0;
|
||||
|
||||
// Add a system (1 Hz)
|
||||
scheduler.add_system(1, [&](float dt) {
|
||||
scheduler.add_system(1, [&](float dt)
|
||||
{
|
||||
zero_dt_count++;
|
||||
});
|
||||
|
||||
|
@ -408,7 +420,8 @@ TEST_CASE("Systems handle negative delta time")
|
|||
int count = 0;
|
||||
|
||||
// Add a system (1 Hz)
|
||||
scheduler.add_system(1, [&](float dt) {
|
||||
scheduler.add_system(1, [&](float dt)
|
||||
{
|
||||
count++;
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue