v / cmd / tools / vcover / testdata / simple / simple.v
26 lines · 22 sloc · 374 bytes · 80397e679e495f5e5aeb3868d1260780d90d8aec
Raw
1module simple
2
3pub fn sum() int {
4 mut res := 0
5 for i in 1 .. 5 {
6 res += i
7 }
8 return res
9}
10
11pub fn mul() int {
12 mut res := 1
13 for i in 1 .. 5 {
14 res *= i
15 }
16 // the lines here are just to introduce an asymmetry in the reported coverage lines
17 c := res * 2
18 _ := c * 10
19 return res
20}
21
22pub const a_const = f()
23
24fn f() int {
25 return 50 // this should be executed always
26}
27