| 1035 | ); |
| 1036 | } |
| 1037 | |
| 1038 | #[test] |
| 1039 | fn test_multiply() { |
| 1040 | // 6 * 7 = 42 |
| 1041 | let (_, outcome) = assemble_and_run(vec![ |
| 1042 | ri(RealInstruction::Addi(Addi::new(11, 0, 6))), // a1 = 6 |
| 1043 | ri(RealInstruction::Addi(Addi::new(12, 0, 7))), // a2 = 7 |
| 1044 | ri(RealInstruction::Mul(Mul::new(10, 11, 12))), // a0 = 6 * 7 = 42 |
| 1045 | ri(RealInstruction::Addi(Addi::new(17, 0, 93))), // a7 = 93 |
| 1046 | ri(RealInstruction::Ecall(Ecall::new())), |
| 1047 | ]); |
| 1048 | assert!( |
| 1049 | matches!(outcome, RunOutcome::Halted(42)), |
| 1050 | "expected Halted(42), got {outcome:?}" |
| 1051 | ); |
| 1052 | } |
| 1053 | |
| 1054 | #[test] |
| 1055 | fn test_divide() { |