test: add unit test for part one
This commit is contained in:
23
internal/2020/DayEight/code_test.go
Normal file
23
internal/2020/DayEight/code_test.go
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package dayeight
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
var testInput = []string{
|
||||||
|
"nop +0",
|
||||||
|
"acc +1",
|
||||||
|
"jmp +4",
|
||||||
|
"acc +3",
|
||||||
|
"jmp -3",
|
||||||
|
"acc -99",
|
||||||
|
"acc +1",
|
||||||
|
"jmp -4",
|
||||||
|
"acc +6",
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestPartOne(t *testing.T) {
|
||||||
|
expected := 5
|
||||||
|
got := PartOne(testInput)
|
||||||
|
if got != expected {
|
||||||
|
t.Errorf("PartOne() = %d, want %d", got, expected)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user