refactor: use shared variable for input
This commit is contained in:
@@ -2,28 +2,24 @@ package main
|
||||
|
||||
import "testing"
|
||||
|
||||
var testInput = []string{
|
||||
"1-3 a: abcde",
|
||||
"1-3 b: cdefg",
|
||||
"2-9 c: ccccccccc",
|
||||
}
|
||||
|
||||
func TestPartOne(t *testing.T) {
|
||||
input := []string{
|
||||
"1-3 a: abcde",
|
||||
"1-3 b: cdefg",
|
||||
"2-9 c: ccccccccc",
|
||||
}
|
||||
expected := 2
|
||||
got := PartOne(input)
|
||||
got := PartOne(testInput)
|
||||
if got != expected {
|
||||
t.Errorf("PartOne(%v) = %d, want %d", input, got, expected)
|
||||
t.Errorf("PartOne(%v) = %d, want %d", testInput, got, expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPartTwo(t *testing.T) {
|
||||
input := []string{
|
||||
"1-3 a: abcde",
|
||||
"1-3 b: cdefg",
|
||||
"2-9 c: ccccccccc",
|
||||
}
|
||||
expected := 1
|
||||
got := PartTwo(input)
|
||||
got := PartTwo(testInput)
|
||||
if got != expected {
|
||||
t.Errorf("PartTwo(%v) = %d, want %d", input, got, expected)
|
||||
t.Errorf("PartTwo(%v) = %d, want %d", testInput, got, expected)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user