55 lines
1.1 KiB
Go
55 lines
1.1 KiB
Go
|
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)
|
||
|
}
|
||
|
}
|