Files
advent-of-code-go/2018/day17/main_test.go
T

64 lines
1.1 KiB
Go

package main
import (
"testing"
"github.com/alexchao26/advent-of-code-go/util"
)
var tests1 = []struct {
name string
want int
input string
// add extra args if needed
}{
{"example", 57, `x=495, y=2..7
y=7, x=495..501
x=501, y=3..7
x=498, y=2..4
x=506, y=1..2
x=498, y=10..13
x=504, y=10..13
y=13, x=498..504`},
{"actual", 38364, util.ReadFile("input.txt")},
}
func TestPart1(t *testing.T) {
for _, tt := range tests1 {
t.Run(tt.name, func(t *testing.T) {
got := part1(tt.input)
if got != tt.want {
t.Errorf("got %v, want %v", got, tt.want)
}
})
}
}
var tests2 = []struct {
name string
want int
input string
// add extra args if needed
}{
{"example", 29, `x=495, y=2..7
y=7, x=495..501
x=501, y=3..7
x=498, y=2..4
x=506, y=1..2
x=498, y=10..13
x=504, y=10..13
y=13, x=498..504`},
{"actual", 30551, util.ReadFile("input.txt")},
}
func TestPart2(t *testing.T) {
for _, tt := range tests2 {
t.Run(tt.name, func(t *testing.T) {
got := part2(tt.input)
if got != tt.want {
t.Errorf("got %v, want %v", got, tt.want)
}
})
}
}