From edd2b0ef73b6e9472db6e106ef6993814679a591 Mon Sep 17 00:00:00 2001 From: MarekSpodBiedry <73122968+MarekSpodBiedry@users.noreply.github.com> Date: Tue, 13 Oct 2026 17:48:22 +0200 Subject: [PATCH] Keep audio-io stream test limits as u64 so it compiles on 32-bit targets (#462) --- crates/audio-io/tests/stream.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/audio-io/tests/stream.rs b/crates/audio-io/tests/stream.rs index 61a28946..7b149ca6 100644 --- a/crates/audio-io/tests/stream.rs +++ b/crates/audio-io/tests/stream.rs @@ -52,13 +52,15 @@ fn streamed_files_match_whole_buffer_encodes() { #[test] fn blocks_past_a_format_limit_are_refused_before_anything_is_written() { let buf = tone(2, 100); - for (format, limit) in [(FileFormat::Aiff, 1usize << 30), (FileFormat::Flac, 1 << 36)] { + for (format, limit) in [(FileFormat::Aiff, 1u64 << 30), (FileFormat::Flac, 1u64 << 36)] { let opts = EncodeOptions { format, bit_depth: BitDepth::Int16, dither: false, bwf: None }; let mut enc = FileEncoder::new(Cursor::new(Vec::new()), &opts, 2, buf.sample_rate, None).unwrap(); enc.write(&buf.channels, 100).unwrap(); - assert!(enc.check_room(limit as u64 / 2).is_ok(), "{format:?}"); - assert!(matches!(enc.check_room(limit as u64), Err(AudioError::TooLarge(_))), "{format:?}"); - assert!(matches!(enc.write(&[], limit), Err(AudioError::TooLarge(_))), "{format:?}"); + assert!(enc.check_room(limit / 2).is_ok(), "{format:?}"); + assert!(matches!(enc.check_room(limit), Err(AudioError::TooLarge(_))), "{format:?}"); + if let Ok(frames) = usize::try_from(limit) { + assert!(matches!(enc.write(&[], frames), Err(AudioError::TooLarge(_))), "{format:?}"); + } assert_eq!(enc.finish().unwrap().into_inner(), encode(&buf, &opts).unwrap()); } }