2016-day03: validating triangle lengths

This commit is contained in:
alexchao26
2020-12-20 23:17:18 -05:00
parent 3412d43ec2
commit 2dbce844d4
2 changed files with 99 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
package main
import (
"testing"
"github.com/alexchao26/advent-of-code-go/util"
)
func Test_countValidTriangles(t *testing.T) {
tests := []struct {
name string
input string
part int
want int
}{
{"actual", util.ReadFile("input.txt"), 1, 862},
{"actual", util.ReadFile("input.txt"), 2, 1577},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := countValidTriangles(tt.input, tt.part); got != tt.want {
t.Errorf("countValidTriangles() = %v, want %v", got, tt.want)
}
})
}
}