integers: add adder

This commit is contained in:
vinchent 2024-09-10 13:04:47 +02:00
parent 25ed3404d8
commit effff8ae16
2 changed files with 17 additions and 0 deletions

5
integers/adder.go Normal file
View File

@ -0,0 +1,5 @@
package integers
func Add(x, y int) int {
return x + y
}

12
integers/adder_test.go Normal file
View File

@ -0,0 +1,12 @@
package integers
import "testing"
func TestAdder(t *testing.T) {
sum := Add(2, 2)
expected := 4
if sum != expected {
t.Errorf("got %d, expected %d", sum, expected)
}
}