Add tests, fix offset logic, and bump dependencies

- Introduce a comprehensive test suite (cli, app, board, tasks, audio)
  and a
  new TESTING.md document describing test execution.
- Correct vertical offset calculation in `BoardState` to use saturating
  subtraction and ceiling division.
- Clamp initial `Offset` values to the provided maximum in
  `Offset::new`.
- Export `load_audio` from the audio thread module and switch to
  `LoopedDecoder` for proper OGG looping.
- Update several crate versions: clap, ratatui, log, rodio, and
  bitflags.
This commit is contained in:
GarandPLG committed 2026-10-18 20:29:04 +02:00
1 parent 9bc42dc898
commit fcdbbaf74c
16 files changed
+817 -246

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
use rodio::Decoder;
use std::{
fs::read,
io::{BufReader, Cursor},
};
use war_in_tunnels::app::threads::{SoundrackParts, Soundtrack, load_audio};
#[test]
fn audio_repeats_after_end_of_file() {
let data = read("soundtracks/default/calm.ogg").unwrap();
let sample_count = Decoder::new(BufReader::new(Cursor::new(data)))
.unwrap()
.count();
assert!(sample_count > 0);
let mut source = load_audio(&Soundtrack::Default, &SoundrackParts::Calm);
assert_eq!(source.by_ref().take(sample_count).count(), sample_count);
assert_eq!(source.take(1024).count(), 1024);
}