test: add unit test for part two and separated inputs as they differ

This commit is contained in:
2025-12-22 10:21:52 +01:00
parent 903b9e2bc7
commit 64e9e5f21c

View File

@@ -2,16 +2,28 @@ package daytwo
import "testing" import "testing"
var testInput = [][]int{ func TestPartOne(t *testing.T) {
input := [][]int{
{5, 1, 9, 5}, {5, 1, 9, 5},
{7, 5, 3}, {7, 5, 3},
{2, 4, 6, 8}, {2, 4, 6, 8},
} }
got := PartOne(input)
func TestPartOne(t *testing.T) {
got := PartOne(testInput)
expected := 18 expected := 18
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 := [][]int{
{5, 9, 2, 8},
{9, 4, 7, 3},
{3, 8, 6, 5},
}
got := PartTwo(input)
expected := 9
if got != expected {
t.Errorf("PartTwo() = %d, want %d", got, expected)
}
}