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) } }) } }