| 2020 | if vq == 200 { |
| 2021 | return 0 |
| 2022 | } |
| 2023 | } |
| 2024 | return 1 |
| 2025 | } |
| 2026 | "#, |
| 2027 | ); |
| 2028 | assert!( |
| 2029 | matches!(outcome, RunOutcome::Halted(0)), |
| 2030 | "two heap i32 slots must be independent (p=100, q=200), got {outcome:?}" |
| 2031 | ); |
| 2032 | } |
| 2033 | |
| 2034 | /// Three-field struct: middle field is at the correct byte offset. |
| 2035 | #[test] |
| 2036 | fn struct_three_field_middle_offset() { |
| 2037 | let (_, outcome, _) = run_hll( |
| 2038 | r#" |
| 2039 | struct Triple { a: i32, b: i32, c: i32 } |
| 2040 | |
| 2041 | make: (x: i32, y: i32, z: i32) -> Triple { |
| 2042 | return { .a = x, .b = y, .c = z } |
| 2043 | } |
| 2044 | |
| 2045 | main: () -> i32 { |
| 2046 | t: Triple = make(1, 99, 3) |
| 2047 | if t.b == 99 { |
| 2048 | return 0 |
| 2049 | } |