v2 / cmd / tools / vcover / testdata / example2 / condition.v
30 lines · 29 sloc · 347 bytes · 80397e679e495f5e5aeb3868d1260780d90d8aec
Raw
1module example2
2
3pub fn condition() int {
4 mut res := 0
5 $if condition1 ? {
6 res += 1
7 }
8 $if condition2 ? {
9 res += 2
10 }
11 $if condition3 ? {
12 res += 4
13 }
14 $if condition4 ? {
15 res += 8
16 }
17 $if condition5 ? {
18 res += 16
19 }
20 $if condition6 ? {
21 res += 32
22 }
23 $if condition7 ? {
24 res += 64
25 }
26 $if condition8 ? {
27 return 128
28 }
29 return res
30}
31