caco 0.5.33

library for dealing with doom [et al] wad files
Documentation
use std::fs::File;

use crate::{agnostic::*, wad::DoomWad};

fn doom_2() -> DoomWad {
    DoomWad::load(&mut File::open("wads-for-tests/doom2.wad").unwrap()).unwrap()
}

#[test]
fn lump_is_a_clump() {
    let d2 = doom_2();
    let lmp = d2.nth_clump(42);
    assert!(lmp.is_clump());
}

#[test]
fn all_wads_are_clods() {
    let d2 = doom_2();
    assert_eq!(d2.ent_amt(), d2.clump_amt());
}

#[test]
fn clod_get_clump_mut() {
    let _v = vec![0u8, 1u8, 2u8, 3u8, 4u8];
    let test_data = _v.into_boxed_slice();

    let mut d2 = doom_2();
    d2.nth_ent_mut(5).take_clump_mut().unwrap().replace(&test_data);

    assert_eq!(*d2.nth_clump(5).bytestuff(), test_data);
}