test: Add unit test for PartTwo
This commit is contained in:
@@ -2,17 +2,33 @@ package main
|
|||||||
|
|
||||||
import "testing"
|
import "testing"
|
||||||
|
|
||||||
var testInput = []string{
|
func TestPartOne(t *testing.T) {
|
||||||
|
input := []string{
|
||||||
"FBFBBFFRLR",
|
"FBFBBFFRLR",
|
||||||
"BFFFBBFRRR",
|
"BFFFBBFRRR",
|
||||||
"FFFBBBFRRR",
|
"FFFBBBFRRR",
|
||||||
"BBFFBBFRLL",
|
"BBFFBBFRLL",
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPartOne(t *testing.T) {
|
|
||||||
expected := 820
|
expected := 820
|
||||||
got := PartOne(testInput)
|
got := PartOne(input)
|
||||||
if got != expected {
|
if got != expected {
|
||||||
t.Errorf("PartOne() = %d, want %d", got, expected)
|
t.Errorf("PartOne() = %d, want %d", got, expected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestPartTwo(t *testing.T) {
|
||||||
|
input := []string{
|
||||||
|
"FFFFFFFLLL",
|
||||||
|
"FFFFFFFLLR",
|
||||||
|
"FFFFFFFLRL",
|
||||||
|
"FFFFFFFLRR",
|
||||||
|
"FFFFFFFRLR",
|
||||||
|
"FFFFFFFRRL",
|
||||||
|
"FFFFFFFRRR",
|
||||||
|
}
|
||||||
|
expected := 4
|
||||||
|
got := PartTwo(input)
|
||||||
|
if got != expected {
|
||||||
|
t.Errorf("PartTwo() = %d, want %d", got, expected)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user