integers: add adder
This commit is contained in:
parent
25ed3404d8
commit
effff8ae16
5
integers/adder.go
Normal file
5
integers/adder.go
Normal file
@ -0,0 +1,5 @@
|
||||
package integers
|
||||
|
||||
func Add(x, y int) int {
|
||||
return x + y
|
||||
}
|
12
integers/adder_test.go
Normal file
12
integers/adder_test.go
Normal 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)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user