refactor: use shared variable for input

This commit is contained in:
2025-11-24 14:05:43 +01:00
parent 1f8652c176
commit 428ec93860
3 changed files with 32 additions and 48 deletions

View File

@@ -2,20 +2,20 @@ package main
import "testing"
var testInput = []int{1721, 979, 366, 299, 675, 1456}
func TestPartOne(t *testing.T) {
input := []int{1721, 979, 366, 299, 675, 1456}
expected := 514579
got := PartOne(input)
got := PartOne(testInput)
if got != expected {
t.Errorf("PartOne(%v) = %d, want %d", input, got, expected)
t.Errorf("PartOne(%v) = %d, want %d", testInput, got, expected)
}
}
func TestPartTwo(t *testing.T) {
input := []int{1721, 979, 366, 299, 675, 1456}
expected := 241861950
got := PartTwo(input)
got := PartTwo(testInput)
if got != expected {
t.Errorf("PartTwo(%v) = %d, want %d", input, got, expected)
t.Errorf("PartTwo(%v) = %d, want %d", testInput, got, expected)
}
}