add test
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2025-05-30 01:05:36 +02:00
parent 8d79ac08a3
commit cf4ee051bb
3 changed files with 41 additions and 1 deletions
+22
View File
@@ -0,0 +1,22 @@
package main
import (
"testing"
)
func Test_sum(t *testing.T) {
tests := []struct {
a, b int
want int
}{
{1, 2, 3},
{-1, 1, 0},
{0, 0, 0},
}
for _, test := range tests {
if got := sum(test.a, test.b); got != test.want {
t.Errorf("sum(%d, %d) = %d, want %d", test.a, test.b, got, test.want)
}
}
}