2024-12-08 13:21:14 +00:00
|
|
|
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)
|
2024-12-08 16:00:28 +00:00
|
|
|
if result != 11387 {
|
|
|
|
t.Fatalf("Expected 11387 received %d", result)
|
2024-12-08 13:21:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-12-08 16:00:28 +00:00
|
|
|
func TestSolvable(t *testing.T) {
|
|
|
|
if !day_07.Solvable(day_07.Equation{
|
|
|
|
Result: 27100,
|
|
|
|
Variables: []int{3, 9, 100},
|
|
|
|
}, 3) {
|
|
|
|
t.Fatalf("Expected true")
|
2024-12-08 13:21:14 +00:00
|
|
|
}
|
2024-12-08 16:00:28 +00:00
|
|
|
|
2024-12-08 13:21:14 +00:00
|
|
|
}
|