advent-of-code/aoc2023/day21/main_test.go

42 lines
636 B
Go
Raw Permalink Normal View History

2024-10-26 12:03:06 -06:00
package main
import (
"bufio"
"bytes"
"testing"
_ "embed"
"github.com/matryer/is"
)
//go:embed example.txt
var example []byte
//go:embed input.txt
var input []byte
func TestExample(t *testing.T) {
is := is.New(t)
scan := bufio.NewScanner(bytes.NewReader(example))
2024-10-30 13:32:44 -06:00
result, err := runner(6)(scan)
2024-10-26 12:03:06 -06:00
is.NoErr(err)
t.Log(result)
2024-10-30 13:32:44 -06:00
is.Equal(result.valuePT1, 16)
2024-10-26 12:03:06 -06:00
is.Equal(result.valuePT2, 0)
}
func TestSolution(t *testing.T) {
is := is.New(t)
scan := bufio.NewScanner(bytes.NewReader(input))
2024-10-30 13:32:44 -06:00
result, err := runner(64)(scan)
2024-10-26 12:03:06 -06:00
is.NoErr(err)
t.Log(result)
2024-10-30 13:32:44 -06:00
is.Equal(result.valuePT1, 3709)
2024-10-26 12:03:06 -06:00
is.Equal(result.valuePT2, 0)
}