advent_of_code_2024/day_08/solution_test.go

55 lines
1.1 KiB
Go
Raw Normal View History

2024-12-08 16:56:36 +00:00
package day_08_test
import (
"advent_of_code_2024/day_08"
_ "embed"
"testing"
)
//go:embed example_data.txt
var ExampleData string
//go:embed example_data_01.txt
var ExampleData01 string
//go:embed example_data_02.txt
var ExampleData02 string
//go:embed example_data_03.txt
var ExampleData03 string
func TestBasicSolutionExample(t *testing.T) {
result := day_08.SolveBasic(ExampleData)
if result != 14 {
t.Fatalf("Expected 14 received %d", result)
}
}
func TestBasicSolutionExample01(t *testing.T) {
result := day_08.SolveBasic(ExampleData01)
if result != 2 {
t.Fatalf("Expected 2 received %d", result)
}
}
func TestBasicSolutionExample02(t *testing.T) {
result := day_08.SolveBasic(ExampleData02)
if result != 4 {
t.Fatalf("Expected 4 received %d", result)
}
}
func TestComplexSolutionExample03(t *testing.T) {
result := day_08.SolveComplex(ExampleData03)
if result != 9 {
t.Fatalf("Expected 9 received %d", result)
}
}
func TestComplexSolutionExample(t *testing.T) {
result := day_08.SolveComplex(ExampleData)
if result != 34 {
t.Fatalf("Expected 34 received %d", result)
}
}