nx_elifprobe.nx source
↩ module page · 33 lines · 900 B
1// nx_elifprobe.nx -- seq358 witness: MULTILINE `else if` chains must parse correctly and the
2// FOLLOWING function must not fuse/vanish (the desync emitted later functions as empty stubs).
3import "nx_syscalls.nx"
4
5func ep_f(a: i64) -> i64 {
6 if a == 1 {
7 let r: i64 = a * 10
8 return r
9 } else if a == 2 {
10 let x: i64 = a + 1
11 let y: i64 = x * 10
12 return y
13 } else if a == 3 {
14 return 40
15 } else {
16 let z: i64 = 7
17 return z
18 }
19}
20
21func ep_g() -> i64 { return 99 }
22
23func main() -> i64 {
24 var bad: i64 = 0
25 if ep_f(1) != 10 { bad = bad + 1 }
26 if ep_f(2) != 30 { bad = bad + 1 }
27 if ep_f(3) != 40 { bad = bad + 1 }
28 if ep_f(9) != 7 { bad = bad + 1 }
29 if ep_g() != 99 { bad = bad + 1 }
30 if bad == 0 { sys_write(1, "ELIF-OK\n" as *u8, 8) }
31 if bad != 0 { sys_write(1, "ELIF-BAD\n" as *u8, 9) }
32 return bad
33}