From ad40c72dfe648180ea58daaa38cb9600ff7cb6ea Mon Sep 17 00:00:00 2001 From: Sam M W Date: Thu, 28 Jan 2021 10:13:44 +0000 Subject: [PATCH] separate unit test for decimal sbc --- src/cpu.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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);