1
0
mirror of https://github.com/mre/mos6502.git synced 2024-11-25 02:33:26 +00:00

separate unit test for decimal sbc

This commit is contained in:
Sam M W 2021-01-28 10:13:44 +00:00
parent 2d87640692
commit ad40c72dfe

View File

@ -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);