You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
356 B
Go
23 lines
356 B
Go
11 months ago
|
package integers
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestAdder(t *testing.T) {
|
||
|
sum := Add(2, 2)
|
||
|
expected := 4
|
||
|
|
||
|
if sum != expected {
|
||
|
t.Errorf("Expected '%d', but got '%d'", expected, sum)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// If your code changes so that the example is no longer valid, your build will fail.
|
||
|
func ExampleAdd() {
|
||
|
sum := Add(1, 5)
|
||
|
fmt.Println(sum)
|
||
|
// Output: 6
|
||
|
}
|