advent_of_code_2024/day_07/solution_test.go

35 lines
635 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 != 11387 {
t.Fatalf("Expected 11387 received %d", result)
}
}
func TestSolvable(t *testing.T) {
if !day_07.Solvable(day_07.Equation{
Result: 27100,
Variables: []int{3, 9, 100},
}, 3) {
t.Fatalf("Expected true")
}
}