Files
advent-of-code-2025/cmd/01/main_test.go
T

54 lines
1.1 KiB
Go
Raw Normal View History

2025-11-28 07:19:14 -06:00
package main_test
import (
"testing"
solution "github.com/StevanFreeborn/advent-of-code-2025/cmd/01"
)
func TestSolvePartOneWithExampleInput(t *testing.T) {
2025-12-01 06:49:26 -06:00
expected := 3
2025-11-28 07:19:14 -06:00
result := solution.SolvePartOne("EXAMPLE.txt")
if result != expected {
2025-12-01 06:49:26 -06:00
t.Errorf(`SolvePartOne("EXAMPLE.txt") = %d; want %d`, result, expected)
}
}
func TestSolvePartOneWithInput(t *testing.T) {
expected := 1011
result := solution.SolvePartOne("INPUT.txt")
if result != expected {
t.Errorf(`SolvePartOne("INPUT.txt") = %d; want %d`, result, expected)
2025-11-28 07:19:14 -06:00
}
}
2025-12-02 07:18:38 -06:00
func TestSolvePartTwoWithExampleInput(t *testing.T) {
expected := 6
result := solution.SolvePartTwo("EXAMPLE.txt")
if result != expected {
t.Errorf(`SolvePartTwo("EXAMPLE.txt") = %d; want %d`, result, expected)
}
}
func TestSolvePartTwoWithInput(t *testing.T) {
expected := -1
tooLow := 5922
2025-12-02 07:18:38 -06:00
tooHigh := 5967
result := solution.SolvePartTwo("INPUT.txt")
if result <= tooLow || result >= tooHigh {
t.Errorf(`SolvePartTwo("INPUT.txt") = %d; want something between %d and %d`, result, tooLow, tooHigh)
}
if result != expected {
t.Errorf(`SolvePartTwo("INPUT.txt") = %d; want %d`, result, expected)
}
}