MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / float_mixed_int_and_f64_arguments

Function float_mixed_int_and_f64_arguments

tests/integration/vm_execution.rs:2451–2476  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2449 "expected Halted(3), got {outcome:?}"
2450 );
2451}
2452
2453#[test]
2454fn float_int_to_float_roundtrip() {
2455 // i32 -> f64 (fcvt.d.w) then f64 -> i32 (fcvt.w.d). Before the fix both
2456 // casts were a plain `mv` reinterpreting the bit pattern.
2457 let (_, outcome, _) = run_hll(
2458 r#"
2459main: () -> i32 {
2460 n: i32 = 7
2461 three: f64 = 3.0
2462 f: f64 = n as f64
2463 g: f64 = f * three
2464 return g as i32
2465}
2466"#,
2467 );
2468 assert!(
2469 matches!(outcome, RunOutcome::Halted(21)),
2470 "expected Halted(21), got {outcome:?}"
2471 );
2472}
2473
2474#[test]
2475fn float_f32_int_cast() {
2476 // i32 -> f32 -> i32 with a non-trivial intermediate value.
2477 let (_, outcome, _) = run_hll(
2478 r#"
2479main: () -> i32 {

Callers

nothing calls this directly

Calls 1

run_hllFunction · 0.70

Tested by

no test coverage detected