v2 / vlib / v / tests / casts / cast_bool_to_int_test.v
14 lines · 12 sloc · 195 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1fn test_cast_bool_to_int() {
2 i := true
3 x := int(i)
4 nx := int(!i)
5 dump(x)
6 dump(nx)
7 a := [1, 2, 3]
8
9 println(a[int(!i)])
10 assert a[int(!i)] == 1
11
12 println(a[int(i)])
13 assert a[int(i)] == 2
14}
15