From ecb3f0745952819d7b0351821496be508180c07c Mon Sep 17 00:00:00 2001 From: Andrew Keeton Date: Thu, 6 Nov 2014 19:30:05 -0500 Subject: [PATCH] Add branch_if_carry_clear_test(). --- src/machine.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/machine.rs b/src/machine.rs index e95411d..6175778 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -860,6 +860,19 @@ fn jump_test() { assert_eq!(machine.registers.program_counter, addr); } +#[test] +fn branch_if_carry_clear_test() { + let mut machine = Machine::new(); + + machine.execute_instruction((instruction::SEC, instruction::UseImplied)); + machine.branch_if_carry_clear(Address(0xABCD)); + assert_eq!(machine.registers.program_counter, Address(0)); + + machine.execute_instruction((instruction::CLC, instruction::UseImplied)); + machine.branch_if_carry_clear(Address(0xABCD)); + assert_eq!(machine.registers.program_counter, Address(0xABCD)); +} + #[test] fn branch_if_minus_test() { {