You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
975 B
Go

package day21
import (
"fmt"
"testing"
"gitea.paas.celticinfo.fr/oabrivard/aoc2023/utils"
)
func TestPart1(t *testing.T) {
lines := []string{
"...........",
".....###.#.",
".###.##..#.",
"..#.#...#..",
"....#.#....",
".##..S####.",
".##..#...#.",
".......##..",
".##.#.####.",
".##..##.##.",
"...........",
}
result := Part1(lines, 1)
if result != 2 {
t.Fatalf("expected 2, got %d", result)
}
result = Part1(lines, 2)
if result != 4 {
t.Fatalf("expected 4, got %d", result)
}
result = Part1(lines, 3)
if result != 6 {
t.Fatalf("expected 6, got %d", result)
}
result = Part1(lines, 6)
if result != 16 {
t.Fatalf("expected 16, got %d", result)
}
for i := 1; i < 20; i++ {
result = Part1(lines, i)
fmt.Println(i, " : ", result)
}
}
func TestPart1WithInput(t *testing.T) {
lines := utils.ReadLines("input.txt")
result := Part1(lines, 64)
if result != 3758 {
t.Fatalf("expected 3758, got %d", result)
}
}