|
@ -148,4 +148,29 @@ humidity-to-location map: |
|
|
t.Errorf("solve1() = %s; wanted %s", res, ans) |
|
|
t.Errorf("solve1() = %s; wanted %s", res, ans) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ans = "46" |
|
|
|
|
|
res = puzzle.solve2(strings.NewReader(input)) |
|
|
|
|
|
if ans != res { |
|
|
|
|
|
t.Errorf("solve2() = %s; wanted %s", res, ans) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func TestDay06(t *testing.T) { |
|
|
|
|
|
input := `Time: 7 15 30 |
|
|
|
|
|
Distance: 9 40 200` |
|
|
|
|
|
|
|
|
|
|
|
puzzle := day06{} |
|
|
|
|
|
|
|
|
|
|
|
ans := "288" |
|
|
|
|
|
res := puzzle.solve1(strings.NewReader(input)) |
|
|
|
|
|
if ans != res { |
|
|
|
|
|
t.Errorf("solve1() = %s; wanted %s", res, ans) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ans = "71503" |
|
|
|
|
|
res = puzzle.solve2(strings.NewReader(input)) |
|
|
|
|
|
if ans != res { |
|
|
|
|
|
t.Errorf("solve2() = %s; wanted %s", res, ans) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|