test: add unit test for p2
This commit is contained in:
1 parent
301d93157c
commit
a3f54530f6
1 file changed
+21
@@ -22,3 +22,24 @@ func TestPartOne(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestPartTwo(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
input string
|
||||||
|
expected int
|
||||||
|
}{
|
||||||
|
{"^v", "^v", 3},
|
||||||
|
{"^>v<", "^>v<", 3},
|
||||||
|
{"^v^v^v^v^v", "^v^v^v^v^v", 11},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
got := PartTwo(tt.input)
|
||||||
|
if got != tt.expected {
|
||||||
|
t.Errorf("PartTwo(%q) = %d, want %d", tt.input, got, tt.expected)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user