test: Add unit test for PartTwo

This commit is contained in:
2025-11-25 22:28:33 +01:00
parent d13ed719e1
commit 021d16cfd7

View File

@@ -2,17 +2,33 @@ package main
import "testing" import "testing"
var testInput = []string{ func TestPartOne(t *testing.T) {
input := []string{
"FBFBBFFRLR", "FBFBBFFRLR",
"BFFFBBFRRR", "BFFFBBFRRR",
"FFFBBBFRRR", "FFFBBBFRRR",
"BBFFBBFRLL", "BBFFBBFRLL",
} }
func TestPartOne(t *testing.T) {
expected := 820 expected := 820
got := PartOne(testInput) got := PartOne(input)
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) {
input := []string{
"FFFFFFFLLL",
"FFFFFFFLLR",
"FFFFFFFLRL",
"FFFFFFFLRR",
"FFFFFFFRLR",
"FFFFFFFRRL",
"FFFFFFFRRR",
}
expected := 4
got := PartTwo(input)
if got != expected {
t.Errorf("PartTwo() = %d, want %d", got, expected)
}
}