tests: add 2022D1 unit tests
This commit is contained in:
36
internal/2022/DayOne/code_test.go
Normal file
36
internal/2022/DayOne/code_test.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package dayone
|
||||
|
||||
import "testing"
|
||||
|
||||
var testInput = []string{
|
||||
"1000",
|
||||
"2000",
|
||||
"3000",
|
||||
"",
|
||||
"4000",
|
||||
"",
|
||||
"5000",
|
||||
"6000",
|
||||
"",
|
||||
"7000",
|
||||
"8000",
|
||||
"9000",
|
||||
"",
|
||||
"10000",
|
||||
}
|
||||
|
||||
func TestPartOne(t *testing.T) {
|
||||
expected := 24000
|
||||
got := PartOne(testInput)
|
||||
if got != expected {
|
||||
t.Errorf("PartOne() = %d, want %d", got, expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPartTwo(t *testing.T) {
|
||||
expected := 45000
|
||||
got := PartTwo(testInput)
|
||||
if got != expected {
|
||||
t.Errorf("PartTwo() = %d, want %d", got, expected)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user