Skip to content

Commit

Permalink
Fix tests by using correct structure on registers
Browse files Browse the repository at this point in the history
  • Loading branch information
dannywillems committed Dec 1, 2023
1 parent d06a168 commit 12ad9d7
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions optimism/src/mips/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,10 @@ mod tests {
funct: 0b000000,
};
interpret_itype(&mut dummy_env, ITypeInstruction::Load32);
assert_eq!(dummy_env.registers[REGISTER_A0 as usize], exp_v);
assert_eq!(
dummy_env.registers.general_purpose[REGISTER_A0 as usize],
exp_v
);
}

#[test]
Expand All @@ -495,8 +498,8 @@ mod tests {
};
interpret_itype(&mut dummy_env, ITypeInstruction::AddImmediate);
assert_eq!(
dummy_env.registers[REGISTER_A1 as usize],
dummy_env.registers[REGISTER_SP as usize] + 4
dummy_env.registers.general_purpose[REGISTER_A1 as usize],
dummy_env.registers.general_purpose[REGISTER_SP as usize] + 4
);
}

Expand All @@ -515,7 +518,10 @@ mod tests {
funct: 0b001010,
};
interpret_itype(&mut dummy_env, ITypeInstruction::LoadUpperImmediate);
assert_eq!(dummy_env.registers[REGISTER_AT as usize], 0xa0000);
assert_eq!(
dummy_env.registers.general_purpose[REGISTER_AT as usize],
0xa0000
);
}

#[test]
Expand All @@ -534,6 +540,9 @@ mod tests {
};
let exp_res = dummy_env.registers[REGISTER_AT as usize] + 27880;
interpret_itype(&mut dummy_env, ITypeInstruction::AddImmediateUnsigned);
assert_eq!(dummy_env.registers[REGISTER_AT as usize], exp_res);
assert_eq!(
dummy_env.registers.general_purpose[REGISTER_AT as usize],
exp_res
);
}
}

0 comments on commit 12ad9d7

Please sign in to comment.