test: add unit test for part two
This commit is contained in:
@@ -2,8 +2,7 @@ package dayfour
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestPartOne(t *testing.T) {
|
||||
input := []string{
|
||||
var testInput = []string{
|
||||
"[1518-11-01 00:00] Guard #10 begins shift",
|
||||
"[1518-11-01 00:05] falls asleep",
|
||||
"[1518-11-01 00:25] wakes up",
|
||||
@@ -22,9 +21,19 @@ func TestPartOne(t *testing.T) {
|
||||
"[1518-11-05 00:45] falls asleep",
|
||||
"[1518-11-05 00:55] wakes up",
|
||||
}
|
||||
|
||||
func TestPartOne(t *testing.T) {
|
||||
expected := 240
|
||||
got := PartOne(input)
|
||||
got := PartOne(testInput)
|
||||
if got != expected {
|
||||
t.Errorf("PartOne() = %d, want %d", got, expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPartTwo(t *testing.T) {
|
||||
expected := 4455
|
||||
got := PartTwo(testInput)
|
||||
if got != expected {
|
||||
t.Errorf("PartTwo() = %d, want %d", got, expected)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user