Unit testing ternary operators...
Oct 29, 2018
...in my compiler makes my head hurt.
i = 1 ? 2 : 3
Assert(i == 2)
i = !1 ? 2 : 3
Assert(i == 3)
i = !1 ? 2 : 3 ? 4 : 5
Assert(i == 4)
i = !1 ? 2 ? 3 : 4 : 5 ? 6 : 7
Assert(i == 6)
i = 1 ? 2 ? 3 : 4 : 5 ? 6 : 7
Assert(i == 3)
i = 1 ? !2 ? 3 : 4 : 5 ? 6 : 7
Assert(i == 4)
i = 1 ? 0 ? 3 : 4 : 5 ? 6 : 7
Assert(i == 4)
i = 1 ? !2 ? 3 ? 4 : 5 : 6 : 7 ? 8 : 9
Assert(i == 6)
Any others I should test?