Test and solution for day 1 of advent calendar.

This commit is contained in:
2017-12-10 15:48:18 -08:00
commit 05c5fff28d
2 changed files with 48 additions and 0 deletions

19
2017/1/1_test.go Normal file
View File

@@ -0,0 +1,19 @@
package main
import "testing"
func TestOne(t *testing.T) {
for _, ts := range []struct {
in string
want int
}{
{in: "1122", want: 3},
{in: "1111", want: 4},
{in: "1234", want: 0},
// {in:"91212129 produces
} {
if got := sum(ts.in); got != ts.want {
t.Errorf("sum(%q) = %d, want %d", ts.in, got, ts.want)
}
}
}