| 1457 | // Expected values are built from safe (<= 2047) operands so the comparison |
| 1458 | // target is not affected by the same bug under test. |
| 1459 | |
| 1460 | /// 42 - exercises the ADDI-only path (value in [-2048, 2047]). |
| 1461 | #[test] |
| 1462 | fn li_small_positive() { |
| 1463 | let (_, outcome, _) = run_hll( |
| 1464 | r#" |
| 1465 | main: () -> i32 { |
| 1466 | v: i32 = 42 |
| 1467 | if v == 42 { |
| 1468 | return 0 |
| 1469 | } |
| 1470 | return 1 |
| 1471 | } |
| 1472 | "#, |
| 1473 | ); |
| 1474 | assert!( |
| 1475 | matches!(outcome, RunOutcome::Halted(0)), |
| 1476 | "li 42 should load 42, got {outcome:?}" |
| 1477 | ); |
| 1478 | } |
| 1479 | |
| 1480 | /// 2047 - last value that fits in a single ADDI. |
| 1481 | #[test] |
| 1482 | fn li_boundary_2047() { |
| 1483 | let (_, outcome, _) = run_hll( |