test: add unit tests
This commit is contained in:
34
2021/day03/main_test.go
Normal file
34
2021/day03/main_test.go
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
var testInput = []string{
|
||||||
|
"00100",
|
||||||
|
"11110",
|
||||||
|
"10110",
|
||||||
|
"10111",
|
||||||
|
"10101",
|
||||||
|
"01111",
|
||||||
|
"00111",
|
||||||
|
"11100",
|
||||||
|
"10000",
|
||||||
|
"11001",
|
||||||
|
"00010",
|
||||||
|
"01010",
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestPartOne(t *testing.T) {
|
||||||
|
expected := 198
|
||||||
|
got := PartOne(testInput)
|
||||||
|
if got != expected {
|
||||||
|
t.Errorf("PartOne() = %d, want %d", got, expected)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestPartTwo(t *testing.T) {
|
||||||
|
expected := 230
|
||||||
|
got := PartTwo(testInput)
|
||||||
|
if got != expected {
|
||||||
|
t.Errorf("PartTwo() = %d, want %d", got, expected)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user