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.
91 lines
1.4 KiB
Go
91 lines
1.4 KiB
Go
package day17
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"gitea.paas.celticinfo.fr/oabrivard/aoc2023/utils"
|
|
)
|
|
|
|
func TestMaxHeatDebug(t *testing.T) {
|
|
lines := []string{
|
|
"24",
|
|
"32",
|
|
}
|
|
|
|
result := MaxHeat(lines, 0, 3)
|
|
|
|
if result != 5 {
|
|
t.Fatalf("expected 5, got %v", result)
|
|
}
|
|
}
|
|
|
|
func TestMaxHeatDebug2(t *testing.T) {
|
|
lines := []string{
|
|
"241343231",
|
|
"321545353",
|
|
"325524565",
|
|
}
|
|
|
|
result := MaxHeat(lines, 0, 3)
|
|
|
|
if result != 37 {
|
|
t.Fatalf("expected 37, got %v", result)
|
|
}
|
|
|
|
result = MaxHeat(lines, 4, 10)
|
|
|
|
if result != 29 {
|
|
t.Fatalf("expected 29, got %v", result)
|
|
}
|
|
}
|
|
|
|
func TestMaxHeat(t *testing.T) {
|
|
lines := []string{
|
|
"2413432311323",
|
|
"3215453535623",
|
|
"3255245654254",
|
|
"3446585845452",
|
|
"4546657867536",
|
|
"1438598798454",
|
|
"4457876987766",
|
|
"3637877979653",
|
|
"4654967986887",
|
|
"4564679986453",
|
|
"1224686865563",
|
|
"2546548887735",
|
|
"4322674655533",
|
|
}
|
|
|
|
result := MaxHeat(lines, 0, 3)
|
|
|
|
if result != 102 {
|
|
t.Fatalf("expected 102, got %v", result)
|
|
}
|
|
|
|
result = MaxHeat(lines, 4, 10)
|
|
|
|
if result != 94 {
|
|
t.Fatalf("expected 94, got %v", result)
|
|
}
|
|
}
|
|
|
|
func TestMaxHeatWithInput(t *testing.T) {
|
|
lines := utils.ReadLines("input.txt")
|
|
|
|
result := MaxHeat(lines, 0, 3)
|
|
|
|
if result != 1260 {
|
|
t.Fatalf("expected 1260, got %v", result)
|
|
}
|
|
}
|
|
|
|
func TestMaxHeatWithInput2(t *testing.T) {
|
|
lines := utils.ReadLines("input.txt")
|
|
|
|
result := MaxHeat(lines, 4, 10)
|
|
|
|
if result != 1416 {
|
|
t.Fatalf("expected 1416, got %v", result)
|
|
}
|
|
}
|