test: add reverse unit test for part two

This commit is contained in:
2025-12-09 20:59:46 +01:00
parent eebe707ef9
commit caa7da5a7d

View File

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