test: add unit test for part one

This commit is contained in:
2025-12-14 10:00:17 +01:00
parent 1e634b7ee9
commit 40bcf3052f

View File

@@ -0,0 +1,16 @@
package dayfourteen
import "testing"
var testInput = []string{
"Comet can fly 14 km/s for 10 seconds, but then must rest for 127 seconds.",
"Dancer can fly 16 km/s for 11 seconds, but then must rest for 162 seconds.",
}
func TestPartOne(t *testing.T) {
expected := 1120
got := calculateMaxDistance(testInput, 1000)
if got != expected {
t.Errorf("calculateMaxDistance(testInput, 1000) = %d, want %d", got, expected)
}
}