Advent-of-Code/year25/tests/main_test.go
2025-12-09 01:50:24 +02:00

252 lines
4.8 KiB
Go

package main_test
import (
"testing"
"git.bizdoc.ro/gabi-public/Advent-of-Code.git/aoc"
"git.bizdoc.ro/gabi-public/Advent-of-Code.git/year25"
)
func TestDays(t *testing.T) {
logger := DiscardLogger
//logger := DefaultLogger
//var skipExperiments = true
//const skipExperiments = false
var tests = []TestCase{
{
Name: "Day1 Part 1 example",
File: "day01_example",
Want: 3,
Handler: year25.Day1Part1,
},
{
Name: "Day1 Part 1",
File: "day01",
Want: 1191,
Handler: year25.Day1Part1,
},
{
Name: "Day1 Part 2 example",
File: "day01_example",
Want: 6,
Handler: year25.Day1Part2Slow,
},
{
Name: "Day1 Part 2",
File: "day01",
Want: 6858,
Handler: year25.Day1Part2Slow,
},
{
Name: "Day1 Part 2 example",
File: "day01_example",
Want: 6,
Handler: year25.Day1Part2Fast,
},
{
Name: "Day1 Part 2",
File: "day01",
Want: 6858,
Handler: year25.Day1Part2Fast,
},
{
Name: "Day2 Part 1 Example",
File: "day02_example",
Want: 1227775554,
Handler: year25.Day2Part1,
},
{
Name: "Day2 Part 1",
File: "day02",
Want: 31839939622,
Handler: year25.Day2Part1,
},
{
Name: "Day2 Part 2 Example",
File: "day02_example",
Want: 4174379265,
Handler: year25.Day2Part2,
},
{
Name: "Day2 Part 2",
File: "day02",
Want: 41662374059,
Handler: year25.Day2Part2,
},
{
Name: "Day2 Part 1 Simple Version",
File: "day02",
Want: 31839939622,
Handler: year25.Day2Part1Simple,
},
{
Name: "Day2 Part 2 Simple Version",
File: "day02",
Want: 41662374059,
Handler: year25.Day2Part2Simple,
},
{
Name: "Day3 Part 1 Example",
File: "day03_example",
Want: 357,
Handler: year25.Day3Part1,
},
{
Name: "Day3 Part 1",
File: "day03",
Want: 17427,
Handler: year25.Day3Part1,
},
{
Name: "Day3 Part 2 Example",
File: "day03_example",
Want: 3121910778619,
Handler: year25.Day3Part2,
},
{
Name: "Day3 Part 2",
File: "day03",
Want: 173161749617495,
Handler: year25.Day3Part2,
},
{
Name: "Day3 Part 2 Compact",
File: "day03_example",
Want: 3121910778619,
Handler: func(ctx aoc.Context) (any, error) {
s, _ := ctx.BodyString()
return year25.Day3Compact(s, 12)
},
},
{
Name: "Day4 Part 1 Example",
File: "day04_example",
Want: 13,
Handler: year25.Day4Part1,
},
{
Name: "Day4 Part 1",
File: "day04",
Want: 1445,
Handler: year25.Day4Part1,
},
{
Name: "Day4 Part 2 Example",
File: "day04_example",
Want: 43,
Handler: year25.Day4Part2,
},
{
Name: "Day4 Part 2",
File: "day04",
Want: 8317,
Handler: year25.Day4Part2,
},
{
Name: "Day5 Part 1 Example",
File: "day05_example",
Want: 3,
Handler: handler(year25.Day5Part1),
},
{
Name: "Day5 Part 1",
File: "day05",
Want: 775,
Handler: handler(year25.Day5Part1),
},
{
Name: "Day5 Part 2 Example",
File: "day05_example",
Want: 14,
Handler: handler(year25.Day5Part2),
},
{
Name: "Day5 Part 2",
File: "day05",
Want: 350684792662845,
Handler: handler(year25.Day5Part2),
},
{
Name: "Day6 Part 1 Example",
File: "day06_example",
Want: 4277556,
Handler: handler(year25.Day6Part1),
},
{
Name: "Day6 Part 1",
File: "day06",
Want: 4412382293768,
Handler: handler(year25.Day6Part1),
},
{
Name: "Day6 Part 2 Example",
File: "day06_example",
Want: 3263827,
Handler: handler(year25.Day6Part2),
},
{
Name: "Day6 Part 2",
File: "day06",
Want: 7858808482092,
Handler: handler(year25.Day6Part2),
},
{
Name: "Day7 Part 1 Example",
File: "day07_example",
Want: 21,
Handler: handler(year25.Day7Part1),
},
{
Name: "Day7 Part 1",
File: "day07",
Want: 1672,
Handler: handler(year25.Day7Part1),
},
{
Name: "Day7 Part 2 Example",
File: "day07_example",
Want: 40,
Handler: handler(year25.Day7Part2),
},
{
Name: "Day7 Part 2",
File: "day07",
Want: 231229866702355,
Handler: handler(year25.Day7Part2),
},
{
Name: "Day8 Part 1 Example",
File: "day08_example",
Want: 40,
Handler: handler2(10, year25.Day8Part1),
},
{
Name: "Day8 Part 1",
File: "day08",
Want: 54180,
Handler: handler2(1_000, year25.Day8Part1),
},
{
Name: "Day8 Part 2 Example",
File: "day08_example",
Want: 25272,
Handler: handler(year25.Day8Part2),
},
{
Name: "Day8 Part 2",
File: "day08",
Want: 25325968,
Handler: handler(year25.Day8Part2),
},
}
runTestCase(t, tests, logger)
}