From 55452008236a0158961686f6dc71070a4377e7a5 Mon Sep 17 00:00:00 2001 From: Kharec Date: Mon, 24 Nov 2025 21:24:43 +0100 Subject: [PATCH] test: add unit tests --- 2021/day01/main_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 2021/day01/main_test.go diff --git a/2021/day01/main_test.go b/2021/day01/main_test.go new file mode 100644 index 0000000..aa5a6a3 --- /dev/null +++ b/2021/day01/main_test.go @@ -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) + } +}