use super::rom_test;

rom_test!(int_nmi_timing, "int_nmi_timing.nes", |nes| {
    assert_eq!(nes.last_instruction(), "0x801B HLT :2 []");
    assert_eq!(nes.clock_count, 260881);
    assert_eq!(nes.cpu_cycle(), 86967);
    assert_eq!(nes.ppu().pixel, 40);
    assert_eq!(nes.ppu().scanline, 241);
    assert_eq!(nes.ppu().cycle, 260905);
    assert_eq!(nes.mem().peek_cpu(0x1FF), Some(0x80));
    assert_eq!(nes.mem().peek_cpu(0x1FE), Some(0x17));
    assert_eq!(nes.mem().peek_cpu(0x1FD), Some(0xA4));
});

rom_test!(int_nmi_exit_timing, "int_nmi_exit_timing.nes", |nes| {
    assert_eq!(nes.last_instruction(), "0x801F HLT :2 []");
    // assert_eq!(nes.clock_count, 260881);
    assert_eq!(nes.cpu_cycle(), 86980);
    assert_eq!(nes.ppu().pixel, 79);
    assert_eq!(nes.ppu().scanline, 241);
    assert_eq!(nes.ppu().cycle, 260905 - 40 + 79);
    assert_eq!(nes.mem().peek_cpu(0x1FF), Some(0x80));
    assert_eq!(nes.mem().peek_cpu(0x1FE), Some(0x1B));
    assert_eq!(nes.mem().peek_cpu(0x1FD), Some(0x26));
});
