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.

70 lines
1.1 KiB
Go

package day16
import (
"testing"
"gitea.paas.celticinfo.fr/oabrivard/aoc2023/utils"
)
func TestPart1(t *testing.T) {
lines := []string{
`.|...\....`,
`|.-.\.....`,
`.....|-...`,
`........|.`,
`..........`,
`.........\`,
`..../.\\..`,
`.-.-/..|..`,
`.|....-|.\`,
`..//.|....`,
}
result := Part1(lines, 0, 0, 'R')
if result != 46 {
t.Fatalf("expected 46, got %v", result)
}
}
func TestPart1WithInput(t *testing.T) {
lines := utils.ReadLines("input.txt")
result := Part1(lines, 0, 0, 'R')
if result != 8021 {
t.Fatalf("expected 8021, got %v", result)
}
}
func TestPart2(t *testing.T) {
lines := []string{
`.|...\....`,
`|.-.\.....`,
`.....|-...`,
`........|.`,
`..........`,
`.........\`,
`..../.\\..`,
`.-.-/..|..`,
`.|....-|.\`,
`..//.|....`,
}
result := Part2(lines)
if result != 51 {
t.Fatalf("expected 51, got %v", result)
}
}
func TestPart2WithInput(t *testing.T) {
lines := utils.ReadLines("input.txt")
result := Part2(lines)
if result != 8216 {
t.Fatalf("expected 8216, got %v", result)
}
}