Files
advent-of-code-go/2015/day02/main_test.go
T
2020-12-26 01:04:54 -05:00

46 lines
816 B
Go

package main
import (
"testing"
"github.com/alexchao26/advent-of-code-go/util"
)
var example = `2x3x4
1x1x10`
func Test_part1(t *testing.T) {
tests := []struct {
name string
input string
want int
}{
{"example", example, 58 + 43},
{"actual", util.ReadFile("input.txt"), 1588178},
}
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
}{
{"actual", util.ReadFile("input.txt"), 3783758},
}
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)
}
})
}
}