From eb5c3f3c2aedba14ee45363e4c26c0f2fb189a56 Mon Sep 17 00:00:00 2001 From: Andrew Keeton Date: Thu, 6 Nov 2014 19:38:56 -0500 Subject: [PATCH] Add branch_if_carry_set_test(). --- src/machine.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/machine.rs b/src/machine.rs index 357b01b..5fbc7c1 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -886,6 +886,19 @@ fn branch_if_carry_clear_test() { assert_eq!(machine.registers.program_counter, Address(0xABCD)); } +#[test] +fn branch_if_carry_set_test() { + let mut machine = Machine::new(); + + machine.execute_instruction((instruction::CLC, instruction::UseImplied)); + machine.branch_if_carry_set(Address(0xABCD)); + assert_eq!(machine.registers.program_counter, Address(0)); + + machine.execute_instruction((instruction::SEC, instruction::UseImplied)); + machine.branch_if_carry_set(Address(0xABCD)); + assert_eq!(machine.registers.program_counter, Address(0xABCD)); +} + #[test] fn branch_if_minus_test() { {