From 198ddc3131d5be8a8e60364aed782d6318b6d812 Mon Sep 17 00:00:00 2001 From: Andrew Keeton Date: Thu, 6 Nov 2014 19:13:42 -0500 Subject: [PATCH] Fix and_test(). --- src/machine.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/machine.rs b/src/machine.rs index e7b6cac..374ace4 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -638,26 +638,26 @@ fn and_test() { let mut machine = Machine::new(); machine.registers.accumulator = 0; - machine.and(0xff); + machine.and(-1); assert_eq!(machine.registers.accumulator, 0); assert_eq!(machine.registers.status.contains(PS_ZERO), true); assert_eq!(machine.registers.status.contains(PS_NEGATIVE), false); - machine.registers.accumulator = 0xff; + machine.registers.accumulator = -1; machine.and(0); assert_eq!(machine.registers.accumulator, 0); assert_eq!(machine.registers.status.contains(PS_ZERO), true); assert_eq!(machine.registers.status.contains(PS_NEGATIVE), false); - machine.registers.accumulator = 0xff; + machine.registers.accumulator = -1; machine.and(0x0f); assert_eq!(machine.registers.accumulator, 0x0f); assert_eq!(machine.registers.status.contains(PS_ZERO), false); assert_eq!(machine.registers.status.contains(PS_NEGATIVE), false); - machine.registers.accumulator = 0xff; - machine.and(0xf0); - assert_eq!(machine.registers.accumulator, 0xf0); + machine.registers.accumulator = -1; + machine.and(-128); + assert_eq!(machine.registers.accumulator, -128); assert_eq!(machine.registers.status.contains(PS_ZERO), false); assert_eq!(machine.registers.status.contains(PS_NEGATIVE), true); }