Reduced commenting of rf64 test case

...to just the line we want to comment-out
This commit is contained in:
Jamie Hardt
2020-12-26 22:22:59 -08:00
parent f978eb95ed
commit 087d98b228

View File

@@ -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::<LittleEndian>().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::<LittleEndian>().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::<LittleEndian>().unwrap();
// let form_size = cursor.read_u64::<LittleEndian>().unwrap();
// let data_size = cursor.read_u64::<LittleEndian>().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::<LittleEndian>().unwrap();
let form_size = cursor.read_u64::<LittleEndian>().unwrap();
let data_size = cursor.read_u64::<LittleEndian>().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::<LittleEndian>().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::<LittleEndian>().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::<LittleEndian>().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::<LittleEndian>().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::<LittleEndian>().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::<LittleEndian>().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)
// }
assert_eq!(4 + 8 + ds64_size as u64 + 8 + data_size + 8 + fmt_size as u64 + 8 + elm1_size as u64, form_size)
}