test: add unit tests

This commit is contained in:
2025-11-24 21:24:43 +01:00
parent 0f33caf778
commit 5545200823

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

@@ -0,0 +1,21 @@
package main
import "testing"
var testInput = []int{199, 200, 208, 210, 200, 207, 240, 269, 260, 263}
func TestPartOne(t *testing.T) {
expected := 7
got := PartOne(testInput)
if got != expected {
t.Errorf("PartOne() = %d, want %d", got, expected)
}
}
func TestPartTwo(t *testing.T) {
expected := 5
got := PartTwo(testInput)
if got != expected {
t.Errorf("PartTwo() = %d, want %d", got, expected)
}
}