From 087d98b2280f0de81039522d6e1b0e81cd9d2c4b Mon Sep 17 00:00:00 2001 From: Jamie Hardt Date: Sat, 26 Dec 2020 22:22:59 -0800 Subject: [PATCH] Reduced commenting of rf64 test case ...to just the line we want to comment-out --- src/wavewriter.rs | 74 +++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/src/wavewriter.rs b/src/wavewriter.rs index 04b69f9..afe598f 100644 --- a/src/wavewriter.rs +++ b/src/wavewriter.rs @@ -397,53 +397,53 @@ fn test_write_bext() { // nearly 5 mins to run I have omitted it from the source for now... // #[test] -// fn test_create_rf64() { -// use std::io::Cursor; -// use super::fourcc::ReadFourCC; -// use byteorder::ReadBytesExt; +fn test_create_rf64() { + use std::io::Cursor; + use super::fourcc::ReadFourCC; + use byteorder::ReadBytesExt; -// let mut cursor = Cursor::new(vec![0u8;0]); -// let format = WaveFmt::new_pcm_stereo(48000, 24); -// let w = WaveWriter::new(&mut cursor, format).unwrap(); + let mut cursor = Cursor::new(vec![0u8;0]); + let format = WaveFmt::new_pcm_stereo(48000, 24); + let w = WaveWriter::new(&mut cursor, format).unwrap(); -// let buf = format.create_frame_buffer(); + let buf = format.create_frame_buffer(); -// let four_and_a_half_hours = 48000 * 16_200; // 4,665,600,000 bytes / 777,600,000 frames + let four_and_a_half_hours = 48000 * 16_200; // 4,665,600,000 bytes / 777,600,000 frames -// let mut af = w.audio_frame_writer().unwrap(); + let mut af = w.audio_frame_writer().unwrap(); -// for _ in 0..four_and_a_half_hours { -// af.write_integer_frame(&buf).unwrap(); -// } -// af.end().unwrap(); + for _ in 0..four_and_a_half_hours { + af.write_integer_frame(&buf).unwrap(); + } + af.end().unwrap(); -// let expected_data_length = four_and_a_half_hours * format.block_alignment as u64; + let expected_data_length = four_and_a_half_hours * format.block_alignment as u64; -// cursor.seek(SeekFrom::Start(0)).unwrap(); -// assert_eq!(cursor.read_fourcc().unwrap(), RF64_SIG); -// assert_eq!(cursor.read_u32::().unwrap(), 0xFFFF_FFFF); -// assert_eq!(cursor.read_fourcc().unwrap(), WAVE_SIG); + cursor.seek(SeekFrom::Start(0)).unwrap(); + assert_eq!(cursor.read_fourcc().unwrap(), RF64_SIG); + assert_eq!(cursor.read_u32::().unwrap(), 0xFFFF_FFFF); + assert_eq!(cursor.read_fourcc().unwrap(), WAVE_SIG); -// assert_eq!(cursor.read_fourcc().unwrap(), DS64_SIG); -// let ds64_size = cursor.read_u32::().unwrap(); -// let form_size = cursor.read_u64::().unwrap(); -// let data_size = cursor.read_u64::().unwrap(); -// assert_eq!(data_size, expected_data_length); -// cursor.seek(SeekFrom::Current(ds64_size as i64 - 16)).unwrap(); + assert_eq!(cursor.read_fourcc().unwrap(), DS64_SIG); + let ds64_size = cursor.read_u32::().unwrap(); + let form_size = cursor.read_u64::().unwrap(); + let data_size = cursor.read_u64::().unwrap(); + assert_eq!(data_size, expected_data_length); + cursor.seek(SeekFrom::Current(ds64_size as i64 - 16)).unwrap(); -// assert_eq!(cursor.read_fourcc().unwrap(), FMT__SIG); -// let fmt_size = cursor.read_u32::().unwrap(); -// cursor.seek(SeekFrom::Current((fmt_size + fmt_size % 2) as i64)).unwrap(); + assert_eq!(cursor.read_fourcc().unwrap(), FMT__SIG); + let fmt_size = cursor.read_u32::().unwrap(); + cursor.seek(SeekFrom::Current((fmt_size + fmt_size % 2) as i64)).unwrap(); -// assert_eq!(cursor.read_fourcc().unwrap(), ELM1_SIG); -// let elm1_size = cursor.read_u32::().unwrap(); -// let data_start = cursor.seek(SeekFrom::Current((elm1_size + elm1_size % 2) as i64)).unwrap(); + assert_eq!(cursor.read_fourcc().unwrap(), ELM1_SIG); + let elm1_size = cursor.read_u32::().unwrap(); + let data_start = cursor.seek(SeekFrom::Current((elm1_size + elm1_size % 2) as i64)).unwrap(); -// assert!((data_start + 8) % 0x4000 == 0, "data content start is not aligned, starts at {}", data_start + 8); -// assert_eq!(cursor.read_fourcc().unwrap(), DATA_SIG); -// assert_eq!(cursor.read_u32::().unwrap(), 0xFFFF_FFFF); -// cursor.seek(SeekFrom::Current(data_size as i64)).unwrap(); + assert!((data_start + 8) % 0x4000 == 0, "data content start is not aligned, starts at {}", data_start + 8); + assert_eq!(cursor.read_fourcc().unwrap(), DATA_SIG); + assert_eq!(cursor.read_u32::().unwrap(), 0xFFFF_FFFF); + cursor.seek(SeekFrom::Current(data_size as i64)).unwrap(); -// assert_eq!(4 + 8 + ds64_size as u64 + 8 + data_size + 8 + fmt_size as u64 + 8 + elm1_size as u64, form_size) -// } \ No newline at end of file + assert_eq!(4 + 8 + ds64_size as u64 + 8 + data_size + 8 + fmt_size as u64 + 8 + elm1_size as u64, form_size) +} \ No newline at end of file