master
1package main
2
3import "testing"
4import "fmt"
5
6func TestAdder(t *testing.T) {
7 sum := Add(2, 2)
8 expected := 4
9
10 if sum != expected {
11 t.Errorf("expected '%d' but got '%d'", expected, sum)
12 }
13}
14
15func ExampleAdd() {
16 sum := Add(1, 5)
17 fmt.Println(sum)
18 // Output: 6
19}