This commit is contained in:
Gabriel Bizdoc 2025-12-14 01:55:01 +02:00
parent a82ebb6c37
commit 4ca72ec739
No known key found for this signature in database
GPG Key ID: 3F0EDAECA5BE9ED9
3 changed files with 0 additions and 293 deletions

View File

@ -1,2 +0,0 @@
data
main.go

View File

@ -1,43 +0,0 @@
package main_test
import (
"bytes"
"io"
"testing"
"git.bizdoc.ro/gabi-public/Advent-of-Code.git/aoc"
"git.bizdoc.ro/gabi-public/Advent-of-Code.git/year25"
)
func BenchmarkDay(b *testing.B) {
var tests = []TestCase{
{
Name: "Day1 Part 2 slow",
File: "day1",
Want: 6858,
Handler: year25.Day1Part2Slow,
},
{
Name: "Day1 Part 2 fast",
File: "day1",
Want: 6858,
Handler: year25.Day1Part2Fast,
},
}
buff, _ := io.ReadAll(getInput("day1"))
r := bytes.NewReader(buff)
r.Reset(buff)
ctx := aoc.Context{Body: r}
for _, test := range tests {
b.Run(test.Name, func(b *testing.B) {
for b.Loop() {
r.Reset(buff)
if test.Handler == nil {
b.Fatalf("%s handler is nil", test.Name)
}
_, _ = test.Handler(ctx)
}
})
}
}

View File

@ -1,248 +0,0 @@
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"
)
var logger = DiscardLogger
func TestDays(t *testing.T) {
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)
}