Files
advent-of-code-go/2020/day03/main_test.go
T
alexchao26 397aac8fa6 cleanup
2020-12-03 21:04:50 -05:00

68 lines
1.0 KiB
Go

package main
import (
"testing"
"github.com/alexchao26/advent-of-code-go/util"
)
var tests1 = []struct {
name string
want int
input string
}{
{"example", 7, `..##.......
#...#...#..
.#....#..#.
..#.#...#.#
.#...##..#.
..#.##.....
.#.#.#....#
.#........#
#.##...#...
#...##....#
.#..#...#.#`},
{"actual", 209, util.ReadFile("input.txt")},
}
func TestPart1(t *testing.T) {
for _, test := range tests1 {
t.Run(test.name, func(t *testing.T) {
got := part1(test.input)
if got != test.want {
t.Errorf("got %v, want %v", got, test.want)
}
})
}
}
var tests2 = []struct {
name string
want int
input string
}{
{"example", 336, `..##.......
#...#...#..
.#....#..#.
..#.#...#.#
.#...##..#.
..#.##.....
.#.#.#....#
.#........#
#.##...#...
#...##....#
.#..#...#.#`},
{"actual", 1574890240, util.ReadFile("input.txt")},
}
func TestPart2(t *testing.T) {
for _, test := range tests2 {
t.Run(test.name, func(t *testing.T) {
got := part2(test.input)
if got != test.want {
t.Errorf("got %v, want %v", got, test.want)
}
})
}
}