use super::*;

#[test]
fn can_read_our_own_archives() {
    let file_data: Vec<u8> = vec![1,2,3,4,5];
    let file_name = "test_file";
    let file = FarFile::new_from_file(file_name, file_data.clone());

    let archive = FarArchive::new_from_files(vec![file]);
    let archive_data = archive.to_vec();

    let mut archive = read_archive(&archive_data).expect("could not read archive");
    archive.load_file_data(&archive_data);

    let new_file = archive.file_index.get(file_name).expect("could not get file");
    let new_file = &archive.file_data[*new_file];
    assert_eq!(new_file.data, file_data);
}