mod common;
use common::*;
use fluxfox::{DiskImage, DiskImageFileFormat, ImageParser};
#[test]
fn test_psi() {
use std::io::Cursor;
let disk_image_buf = std::fs::read(".\\tests\\images\\Transylvania.psi").unwrap();
let mut in_buffer = Cursor::new(disk_image_buf);
let mut img_image = DiskImage::load(&mut in_buffer, None, None, None).unwrap();
println!("Loaded PSI image of geometry {}...", img_image.image_format().geometry);
let mut out_buffer = Cursor::new(Vec::new());
let fmt = DiskImageFileFormat::RawSectorImage;
fmt.save_image(&mut img_image, &mut out_buffer).unwrap();
let out_inner: Vec<u8> = out_buffer.into_inner();
let in_hash = compute_file_hash(".\\tests\\images\\Transylvania.img");
println!("Input file SHA1: {}", in_hash);
let out_hash = compute_slice_hash(&out_inner);
println!("Output file SHA1: {:}", out_hash);
if in_hash != out_hash {
println!("Hashes do not match!");
}
assert_eq!(in_hash, out_hash);
println!("Hashes match!");
}