Add integers module

This commit is contained in:
2026-03-15 23:12:11 +01:00
parent 803c9d1be9
commit 2b554d42c7
2 changed files with 28 additions and 0 deletions

22
integers/adder_test.go Normal file
View File

@@ -0,0 +1,22 @@
package integers
import (
"fmt"
"testing"
)
func TestAdder(t *testing.T) {
sum := Add(2, 2)
// Output: 9
expected := 4
if sum != expected {
t.Errorf("expected '%d' but got '%d'", expected, sum)
}
}
// Runnable example testing
func ExampleAdd() {
fmt.Println(Add(2, 4))
// Output: 6
}

6
integers/integers.go Normal file
View File

@@ -0,0 +1,6 @@
package integers
// Add two numbers together
func Add(x, y int) int {
return x + y
}