test: add unit test for part two

This commit is contained in:
2025-12-06 23:57:23 +01:00
parent f8a2e839b9
commit 89b2ec90f2

View File

@@ -2,8 +2,7 @@ package dayfour
import "testing"
func TestPartOne(t *testing.T) {
input := []string{
var testInput = []string{
"[1518-11-01 00:00] Guard #10 begins shift",
"[1518-11-01 00:05] falls asleep",
"[1518-11-01 00:25] wakes up",
@@ -21,10 +20,20 @@ func TestPartOne(t *testing.T) {
"[1518-11-05 00:03] Guard #99 begins shift",
"[1518-11-05 00:45] falls asleep",
"[1518-11-05 00:55] wakes up",
}
}
func TestPartOne(t *testing.T) {
expected := 240
got := PartOne(input)
got := PartOne(testInput)
if got != expected {
t.Errorf("PartOne() = %d, want %d", got, expected)
}
}
func TestPartTwo(t *testing.T) {
expected := 4455
got := PartTwo(testInput)
if got != expected {
t.Errorf("PartTwo() = %d, want %d", got, expected)
}
}