Skip to content

Commit

Permalink
More av::AudioPcmBuf tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yury committed Nov 5, 2024
1 parent 401240f commit 5c8463c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cidre/src/av/audio/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ mod tests {
.unwrap();
let cap = 1024;
let mut buf = av::AudioPcmBuf::with_format(&format, cap).unwrap();
buf.set_frame_length(cap);
buf.set_frame_length(cap).unwrap();
let data = buf.data_f32();
let (n, cap) = if format.is_interleaved() {
(1, channel_count * cap)
Expand All @@ -283,6 +283,7 @@ mod tests {
let sum = left.iter().sum();
assert_eq!(0.0f32, sum);
}

#[test]
fn safe() {
let channel_count = 2;
Expand All @@ -292,5 +293,7 @@ mod tests {
let cap = 1024;
let mut buf = av::AudioPcmBuf::with_format(&format, cap).unwrap();
let _err = buf.set_frame_length(1025).expect_err("Should fail");
buf.set_frame_length(1024)
.expect("Failed to set max cap frame len");
}
}

0 comments on commit 5c8463c

Please sign in to comment.