test: add unit test

This commit is contained in:
2025-11-24 12:47:34 +01:00
parent 4727c2b822
commit 3ecc3de9bf

21
2020/day01/main_test.go Normal file
View File

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