2024-12-10 09:13:42 +00:00
|
|
|
package day_10_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"advent_of_code_2024/day_10"
|
|
|
|
_ "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
|
|
|
|
|
2024-12-10 09:22:05 +00:00
|
|
|
//go:embed example_data_04.txt
|
|
|
|
var ExampleData04 string
|
|
|
|
|
2024-12-10 09:13:42 +00:00
|
|
|
func TestBasicSolutionExample(t *testing.T) {
|
|
|
|
result := day_10.SolveBasic(ExampleData)
|
|
|
|
if result != 36 {
|
|
|
|
t.Fatalf("Expected 36 received %d", result)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestBasicSolutionExample01(t *testing.T) {
|
|
|
|
result := day_10.SolveBasic(ExampleData01)
|
|
|
|
if result != 2 {
|
|
|
|
t.Fatalf("Expected 2 received %d", result)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestBasicSolutionExample02(t *testing.T) {
|
|
|
|
result := day_10.SolveBasic(ExampleData02)
|
|
|
|
if result != 3 {
|
|
|
|
t.Fatalf("Expected 3 received %d", result)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestBasicSolutionExample03(t *testing.T) {
|
|
|
|
result := day_10.SolveBasic(ExampleData03)
|
|
|
|
if result != 4 {
|
|
|
|
t.Fatalf("Expected 4 received %d", result)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestComplexSolutionExample(t *testing.T) {
|
|
|
|
result := day_10.SolveComplex(ExampleData)
|
2024-12-10 09:22:05 +00:00
|
|
|
if result != 81 {
|
|
|
|
t.Fatalf("Expected 81 received %d", result)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestComplexSolutionExample03(t *testing.T) {
|
|
|
|
result := day_10.SolveComplex(ExampleData03)
|
|
|
|
if result != 13 {
|
|
|
|
t.Fatalf("Expected 13 received %d", result)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestComplexSolutionExample04(t *testing.T) {
|
|
|
|
result := day_10.SolveComplex(ExampleData04)
|
|
|
|
if result != 227 {
|
|
|
|
t.Fatalf("Expected 227 received %d", result)
|
2024-12-10 09:13:42 +00:00
|
|
|
}
|
|
|
|
}
|