diff --git a/src/cpu.rs b/src/cpu.rs index d03b6d4..9dc5aa1 100644 --- a/src/cpu.rs +++ b/src/cpu.rs @@ -780,7 +780,7 @@ mod tests { use num::range_inclusive; #[test] - fn decimal_mode_test() { + fn decimal_add_test() { let mut cpu = CPU::new(); cpu.registers.status.or(Status::PS_DECIMAL_MODE); @@ -804,7 +804,13 @@ mod tests { assert_eq!(cpu.registers.status.contains(Status::PS_ZERO), true); assert_eq!(cpu.registers.status.contains(Status::PS_NEGATIVE), false); assert_eq!(cpu.registers.status.contains(Status::PS_OVERFLOW), true); + } + #[test] + fn decimal_subtract_test() { + let mut cpu = CPU::new(); + cpu.registers.status.or(Status::PS_DECIMAL_MODE); + cpu.subtract_with_carry(0x48); assert_eq!(cpu.registers.accumulator as u8, 0x52); assert_eq!(cpu.registers.status.contains(Status::PS_CARRY), true);