From 034689df5a404e6b6172808d6087e230250f3e83 Mon Sep 17 00:00:00 2001 From: Alexander Avery Date: Wed, 6 Dec 2023 23:09:23 -0500 Subject: [PATCH] add day 6 to main.go and tests --- main.go | 1 + main_test.go | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/main.go b/main.go index b589891..a9b00f1 100644 --- a/main.go +++ b/main.go @@ -25,6 +25,7 @@ var ( &day03{}, &day04{}, &day05{}, + &day06{}, } ) diff --git a/main_test.go b/main_test.go index f488e5f..7bb1cf6 100644 --- a/main_test.go +++ b/main_test.go @@ -148,4 +148,29 @@ humidity-to-location map: 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) + } }