Alexander Avery
1 year ago
4 changed files with 1124 additions and 70 deletions
File diff suppressed because it is too large
@ -0,0 +1,37 @@ |
|||
package main |
|||
|
|||
import ( |
|||
"strings" |
|||
"testing" |
|||
) |
|||
|
|||
func TestDay01(t *testing.T) { |
|||
ans1 := "142" |
|||
input1 := `1abc2 |
|||
pqr3stu8vwx |
|||
a1b2c3d4e5f |
|||
treb7uchet` |
|||
|
|||
ans2 := "281" |
|||
input2 := `two1nine |
|||
eightwothree |
|||
abcone2threexyz |
|||
xtwone3four |
|||
4nineeightseven2 |
|||
zoneight234 |
|||
7pqrstsixteen` |
|||
|
|||
puzzle := day01{} |
|||
|
|||
res1 := puzzle.solve1(strings.NewReader(input1)) |
|||
t.Logf("day 1 solution 1: %s", res1) |
|||
if res1 != ans1 { |
|||
t.Errorf("day 1 solution 1 = %s; wanted %s", res1, ans1) |
|||
} |
|||
|
|||
res2 := puzzle.solve2(strings.NewReader(input2)) |
|||
t.Logf("day 1 solution 2: %s", res2) |
|||
if res2 != ans2 { |
|||
t.Errorf("day 1 solution 2 = %s; wanted %s", res2, ans2) |
|||
} |
|||
} |
Loading…
Reference in new issue