learn-go-with-tests/integers/adder_test.go
2025-02-01 21:18:14 -05:00

21 lines
261 B
Go

package integers
import (
"fmt"
"testing"
)
func TestAdder(t *testing.T) {
sum := Add(2, 2)
expected := 4
if sum != expected {
t.Errorf("expected %d got %d", expected, sum)
}
}
func ExampleAdd() {
sum := Add(1, 5)
fmt.Println(sum)
// Output: 6
}