disassembler: 100% line coverage

This commit is contained in:
John 2023-03-30 08:53:10 -05:00
parent cc3bc3a7fe
commit c1f457814d
2 changed files with 17 additions and 1 deletions

View File

@ -6,7 +6,7 @@ use owo_colors::{OwoColorize, Style};
use std::fmt::Display;
#[allow(non_camel_case_types, non_snake_case, missing_docs)]
#[derive(Clone, Copy, InstructionSet)]
#[derive(Clone, Copy, Debug, InstructionSet, PartialEq, Eq)]
/// Implements a Disassembler using imperative_rs
pub enum Insn {
/// | 00e0 | Clear screen memory to 0s

View File

@ -189,6 +189,22 @@ mod cpu {
}
}
mod dis {
use chirp::cpu::disassembler::Insn;
use imperative_rs::InstructionSet;
#[test]
fn clone() {
let opcode = Insn::decode(&[0xeF, 0xa1]).unwrap().1; // random valid opcode
let clone = opcode.clone();
assert_eq!(opcode, clone);
}
#[test]
fn debug() {
println!("{:?}", Insn::decode(b"AA")) // "sne #41, v1"
}
}
#[test]
fn error() {
let error = chirp::error::Error::MissingRegion { region: Screen };