Files
advent-of-code-go/2017/day20/main_test.go
T

52 lines
1.0 KiB
Go

package main
import (
"testing"
"github.com/alexchao26/advent-of-code-go/util"
)
var example = `p=< 3,0,0>, v=< 2,0,0>, a=<-1,0,0>
p=< 4,0,0>, v=< 0,0,0>, a=<-2,0,0>`
var example2 = `p=<-6,0,0>, v=< 3,0,0>, a=< 0,0,0>
p=<-4,0,0>, v=< 2,0,0>, a=< 0,0,0>
p=<-2,0,0>, v=< 1,0,0>, a=< 0,0,0>
p=< 3,0,0>, v=<-1,0,0>, a=< 0,0,0>`
func Test_part1(t *testing.T) {
tests := []struct {
name string
input string
want int
}{
{"example", example, 0},
{"actual", util.ReadFile("input.txt"), 170},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := part1(tt.input); got != tt.want {
t.Errorf("part1() = %v, want %v", got, tt.want)
}
})
}
}
func Test_part2(t *testing.T) {
tests := []struct {
name string
input string
want int
}{
{"example", example2, 1},
{"actual", util.ReadFile("input.txt"), 571},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := part2(tt.input); got != tt.want {
t.Errorf("part2() = %v, want %v", got, tt.want)
}
})
}
}