Skip to content

Commit

Permalink
Add generic function to test file
Browse files Browse the repository at this point in the history
  • Loading branch information
uudashr committed Jul 4, 2022
1 parent a225a32 commit f87a5d1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions testdata/src/c/c.go
Expand Up @@ -34,3 +34,15 @@ func (t *Triple[K, V, T]) String() string { // want "cognitive complexity 1 of f

return ""
} // total complexity = 1

type Number interface {
int64 | float64
}

func SumNumbers[K comparable, V Number](m map[K]V) V { // want "cognitive complexity 1 of func SumNumbers is high \\(> 0\\)"
var s V
for _, v := range m {
s += v
}
return s
} // total complexity = 1

0 comments on commit f87a5d1

Please sign in to comment.