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.

111 lines
1.7 KiB
Go

package day14
import (
"testing"
"gitea.paas.celticinfo.fr/oabrivard/aoc2023/utils"
)
func TestSumWeights(t *testing.T) {
lines := []string{
"OOOO.#.O..",
"OO..#....#",
"OO..O##..O",
"O..#.OO...",
"........#.",
"..#....#.#",
"..O..#.O.O",
"..O.......",
"#....###..",
"#....#....",
}
result := SumWeights(lines)
if result != 136 {
t.Fatalf("expected 136, got %v", result)
}
}
func TestSumWeights2(t *testing.T) {
lines := []string{
"O....#....",
"O.OO#....#",
".....##...",
"OO.#O....O",
".O.....O#.",
"O.#..O.#.#",
"..O..#O..O",
".......O..",
"#....###..",
"#OO..#....",
}
result := SumWeights(lines)
if result != 136 {
t.Fatalf("expected 136, got %v", result)
}
}
func TestSumWeights3(t *testing.T) {
lines := []string{
".....#....",
"....#...O#",
".....##...",
"...#......",
".....OOO#.",
".O#...O#.#",
"....O#...O",
"......OOOO",
"#...O###.O",
"#..OO#..OO",
}
result := SumWeights(lines)
if result != 136 {
t.Fatalf("expected 136, got %v", result)
}
}
func TestSumWeightsWithInput(t *testing.T) {
lines := utils.ReadLines("input.txt")
result := SumWeights(lines)
if result != 106378 {
t.Fatalf("expected 106378, got %v", result)
}
}
func TestSumWeightsAfterTilts(t *testing.T) {
lines := []string{
"O....#....",
"O.OO#....#",
".....##...",
"OO.#O....O",
".O.....O#.",
"O.#..O.#.#",
"..O..#O..O",
".......O..",
"#....###..",
"#OO..#....",
}
result := SumWeightsAfterTilts(lines)
if result != 64 {
t.Fatalf("expected 64, got %v", result)
}
}
func TestSumWeightsAfterTiltsWithInput(t *testing.T) {
lines := utils.ReadLines("input.txt")
result := SumWeightsAfterTilts(lines)
if result != 90795 {
t.Fatalf("expected 90795, got %v", result)
}
}