2 Commits

Author SHA1 Message Date
2b554d42c7 Add integers module 2026-03-15 23:12:11 +01:00
803c9d1be9 Move go.mod back to root 2026-03-15 23:10:56 +01:00
3 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
}