| 2484 | return h as i32 |
| 2485 | } |
| 2486 | "#, |
| 2487 | ); |
| 2488 | // 9.0 + 0.5 = 9.5, * 2.0 = 19.0 -> 19. |
| 2489 | assert!( |
| 2490 | matches!(outcome, RunOutcome::Halted(19)), |
| 2491 | "expected Halted(19), got {outcome:?}" |
| 2492 | ); |
| 2493 | } |
| 2494 | |
| 2495 | #[test] |
| 2496 | fn float_f32_to_f64_widen() { |
| 2497 | // f32 -> f64 conversion (fcvt.d.s). 3.5 widened, + 1.5 = 5.0 -> 5. |
| 2498 | let (_, outcome, _) = run_hll( |
| 2499 | r#" |
| 2500 | main: () -> i32 { |
| 2501 | a: f32 = 3.5 |
| 2502 | onefive: f64 = 1.5 |
| 2503 | b: f64 = a as f64 |
| 2504 | c: f64 = b + onefive |
| 2505 | return c as i32 |
| 2506 | } |
| 2507 | "#, |
| 2508 | ); |
| 2509 | assert!( |
| 2510 | matches!(outcome, RunOutcome::Halted(5)), |