advent_of_code_2024/helpers/helpers.go

19 lines
340 B
Go

package helpers
import (
"strings"
"testing"
)
type Function func(input string) int
func Check(t *testing.T, f Function, input string, expected int) {
if actual := f(input); actual != expected {
t.Fatalf("Expected %v, got %v", expected, actual)
}
}
func Format(input string) string {
return strings.ReplaceAll(input, "\r", "")
}