35 lines
692 B
Go
35 lines
692 B
Go
package day_07_test
|
|
|
|
import (
|
|
"advent_of_code_2024/day_07"
|
|
_ "embed"
|
|
"testing"
|
|
)
|
|
|
|
//go:embed example_data.txt
|
|
var ExampleData string
|
|
|
|
func TestBasicSolutionExample(t *testing.T) {
|
|
result := day_07.SolveBasic(ExampleData)
|
|
if result != 3749 {
|
|
t.Fatalf("Expected 3749 received %d", result)
|
|
}
|
|
}
|
|
|
|
func TestComplexSolutionExample(t *testing.T) {
|
|
result := day_07.SolveComplex(ExampleData)
|
|
if result != 6 {
|
|
t.Fatalf("Expected 6 received %d", result)
|
|
}
|
|
}
|
|
|
|
func TestSolvableExample(t *testing.T) {
|
|
result := day_07.Solvable(day_07.Equation{
|
|
Result: 45694842,
|
|
Variables: []int{2, 9, 227, 6, 1, 5, 4, 382, 1, 5, 2},
|
|
})
|
|
if !result {
|
|
t.Fatalf("Expected true received false")
|
|
}
|
|
}
|