test: add unit test
This commit is contained in:
21
2020/day01/main_test.go
Normal file
21
2020/day01/main_test.go
Normal 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)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user