| 1320 | if ops[0](40, 2) != 42 { return 1 } |
| 1321 | if ops[1](6, 7) != 42 { return 2 } |
| 1322 | return 0 |
| 1323 | } |
| 1324 | "#, |
| 1325 | ); |
| 1326 | assert!( |
| 1327 | matches!(outcome, RunOutcome::Halted(0)), |
| 1328 | "indexed fn-pointer call should pass, got {outcome:?}" |
| 1329 | ); |
| 1330 | } |
| 1331 | |
| 1332 | // --- Calling convention (merged from calling_convention_exec.rs) --- |
| 1333 | // All programs return 0 (pass) or 1 (fail). |
| 1334 | |
| 1335 | /// All eight argument registers (a0-a7) are passed and summed correctly. |
| 1336 | #[test] |
| 1337 | fn call_eight_args_all_used() { |
| 1338 | let (_, outcome, _) = run_hll( |
| 1339 | r#" |
| 1340 | sum_eight: (a: i32, b: i32, c: i32, d: i32, e: i32, f: i32, g: i32, h: i32) -> i32 { |
| 1341 | return a + b + c + d + e + f + g + h |
| 1342 | } |
| 1343 | main: () -> i32 { |