test: add check for skip_first_dt flag in puzzle timeout behavior

This commit is contained in:
epic-64 2025-11-19 00:00:00 +01:00
parent 7be94e225a
commit 241693217e
3 changed files with 5 additions and 0 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -761,6 +761,11 @@ mod tests {
fn puzzle_timeout_sets_guess_result() {
let mut p = BinaryNumbersPuzzle::new(Bits::Four, 0);
p.time_left = 0.5;
// First run() skips dt due to skip_first_dt flag
// The reason for this is to prevent timer jump when starting a new puzzle
p.run(1.0);
assert_eq!(p.guess_result, None, "First run should skip dt");
// Second run() actually applies the dt and triggers timeout
p.run(1.0); // exceed remaining time
assert_eq!(p.guess_result, Some(GuessResult::Timeout));
}