16 lines
428 B
Rust
16 lines
428 B
Rust
|
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);
|
||
|
}
|