Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Jan 14, 2025
1 parent 604764b commit 882db20
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions vlib/v/tests/generics/generic_var_loop_test.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import math

fn t[T](a1 []int, a2 []int) T {
mut a := 0 * a1[0] - a2[0]
a = math.max(a, 10)
mut t := T{}
for i in a .. 20 {
t += i
for j in a .. 20 {
t += j
}
}
return t
}

fn test_main() {
assert t[int]([1, 2, 3], [4, 5, 6]) == 1595
}

0 comments on commit 882db20

Please sign in to comment.