mirror of
https://github.com/lucaspalomodevelop/binbreak.git
synced 2026-03-13 00:07:28 +00:00
test: add check for skip_first_dt flag in puzzle timeout behavior
This commit is contained in:
parent
7be94e225a
commit
241693217e
BIN
docs/sc8.png
BIN
docs/sc8.png
Binary file not shown.
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.2 KiB |
BIN
docs/sc9.png
BIN
docs/sc9.png
Binary file not shown.
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.2 KiB |
@ -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));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user