Files
war-in-tunnels/tests/audio.rs
T
GarandPLG c4313b4117 Add rustfmt configuration and reformat code
- Document new Rust formatting standards in AGENTS, CODE_MAP, and
  PROGRESS.
- Add rustfmt.toml with style 2024, 2‑space indents, 100‑char width, LF
  endings.
- Apply consistent 2‑space indentation and ordering across source files.
- Minor clean‑up of imports and whitespace to match the new style.
2026-10-19 12:21:20 +02:00

20 lines
581 B
Rust

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);
}