ferris-boi/tests/cpu/control.rs

16 lines
428 B
Rust
Raw Normal View History

2023-11-21 19:55:40 +00:00
use ferris_boi::cpu::{instructions::Instruction, Processor};
#[test]
fn test_can_jump_to_immediate() {
let mut processor = Processor::default();
let data = [0xC3, 0x37, 0x13, 0x06];
let (ins, extra_data) = Instruction::from_data(&data).expect("could not parse instruction");
assert_eq!(extra_data, &[0x06]);
processor.run_instruction(ins);
assert_eq!(0x1337, processor.registers.program_counter);
}