1
0
mirror of https://github.com/mre/mos6502.git synced 2024-12-22 12:29:31 +00:00

Fix tests.

This commit is contained in:
Andrew Keeton 2015-01-17 18:41:28 -05:00
parent 5e4dc965bf
commit 93b6356cbf

View File

@ -1129,10 +1129,11 @@ fn branch_if_overflow_set_test() {
} }
#[cfg(test)] #[cfg(test)]
fn compare_test_helper<F: FnMut(&mut Machine, u8)> ( fn compare_test_helper<F> (
compare: F, compare: &mut F,
load_instruction: Instruction load_instruction: Instruction
) { ) where F: FnMut(&mut Machine, u8)
{
let mut machine = Machine::new(); let mut machine = Machine::new();
machine.execute_instruction( machine.execute_instruction(
@ -1198,7 +1199,7 @@ fn compare_test_helper<F: FnMut(&mut Machine, u8)> (
#[test] #[test]
fn compare_with_a_register_test() { fn compare_with_a_register_test() {
compare_test_helper( compare_test_helper(
|machine: &mut Machine, val: u8| { &mut |machine: &mut Machine, val: u8| {
machine.compare_with_a_register(val); machine.compare_with_a_register(val);
}, },
Instruction::LDA Instruction::LDA
@ -1208,7 +1209,7 @@ fn compare_with_a_register_test() {
#[test] #[test]
fn compare_with_x_register_test() { fn compare_with_x_register_test() {
compare_test_helper( compare_test_helper(
|machine: &mut Machine, val: u8| { &mut |machine: &mut Machine, val: u8| {
machine.compare_with_x_register(val); machine.compare_with_x_register(val);
}, },
Instruction::LDX Instruction::LDX
@ -1218,7 +1219,7 @@ fn compare_with_x_register_test() {
#[test] #[test]
fn compare_with_y_register_test() { fn compare_with_y_register_test() {
compare_test_helper( compare_test_helper(
|machine: &mut Machine, val: u8| { &mut |machine: &mut Machine, val: u8| {
machine.compare_with_y_register(val); machine.compare_with_y_register(val);
}, },
Instruction::LDY Instruction::LDY
@ -1226,11 +1227,12 @@ fn compare_with_y_register_test() {
} }
#[test] #[test]
#[allow(overflowing_literals)]
fn exclusive_or_test() { fn exclusive_or_test() {
let mut machine = Machine::new(); let mut machine = Machine::new();
for a_before in range(0u8, 255u8) { for a_before in 0u8..256u8 {
for val in range(0u8, 255u8) { for val in 0u8..256u8 {
machine.execute_instruction( machine.execute_instruction(
(Instruction::LDA, OpInput::UseImmediate(a_before)) (Instruction::LDA, OpInput::UseImmediate(a_before))
); );
@ -1256,11 +1258,12 @@ fn exclusive_or_test() {
} }
#[test] #[test]
#[allow(overflowing_literals)]
fn inclusive_or_test() { fn inclusive_or_test() {
let mut machine = Machine::new(); let mut machine = Machine::new();
for a_before in range(0u8, 255u8) { for a_before in 0u8..256u8 {
for val in range(0u8, 255u8) { for val in 0u8..256u8 {
machine.execute_instruction( machine.execute_instruction(
(Instruction::LDA, OpInput::UseImmediate(a_before)) (Instruction::LDA, OpInput::UseImmediate(a_before))
); );