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"
var testInput = []string{
"FBFBBFFRLR",
"BFFFBBFRRR",
"FFFBBBFRRR",
"BBFFBBFRLL",
}
func TestPartOne(t *testing.T) {
input := []string{
"FBFBBFFRLR",
"BFFFBBFRRR",
"FFFBBBFRRR",
"BBFFBBFRLL",
}
expected := 820
got := PartOne(testInput)
got := PartOne(input)
if 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)
}
}