test: add unit test for part one

This commit is contained in:
2025-12-09 20:14:22 +01:00
parent 99eb0fbaa8
commit 8960dcb072

View File

@@ -0,0 +1,18 @@
package dayfour
import "testing"
var testInput = []string{
"aaaaa-bbb-z-y-x-123[abxyz]",
"a-b-c-d-e-f-g-h-987[abcde]",
"not-a-real-room-404[oarel]",
"totally-real-room-200[decoy]",
}
func TestPartOne(t *testing.T) {
expected := 1514
got := PartOne(testInput)
if got != expected {
t.Errorf("PartOne() = %d, want %d", got, expected)
}
}