From 64e9e5f21ce95331dc62d2d93fe52e61e6f24c6e Mon Sep 17 00:00:00 2001 From: Kharec Date: Mon, 22 Dec 2025 10:21:52 +0100 Subject: [PATCH] test: add unit test for part two and separated inputs as they differ --- internal/2017/DayTwo/code_test.go | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/internal/2017/DayTwo/code_test.go b/internal/2017/DayTwo/code_test.go index 56a6313..22b0ff6 100644 --- a/internal/2017/DayTwo/code_test.go +++ b/internal/2017/DayTwo/code_test.go @@ -2,16 +2,28 @@ package daytwo import "testing" -var testInput = [][]int{ - {5, 1, 9, 5}, - {7, 5, 3}, - {2, 4, 6, 8}, -} - func TestPartOne(t *testing.T) { - got := PartOne(testInput) + input := [][]int{ + {5, 1, 9, 5}, + {7, 5, 3}, + {2, 4, 6, 8}, + } + got := PartOne(input) expected := 18 if 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) + } +}