package main import "testing" func TestFib(t *testing.T) { cases := []struct { n, want int }{ {0, 0}, {1, 1}, {2, 1}, {5, 5}, {10, 55}, } for _, c := range cases { if got := fib(c.n); got != c.want { t.Errorf("fib(%d) = %d, want %d", c.n, got, c.want) } } }