advent-of-code/aoc2024/day03/main_test.go

45 lines
738 B
Go
Raw Normal View History

package main
import (
"bytes"
"testing"
_ "embed"
"github.com/matryer/is"
)
//go:embed example.txt
var example []byte
//go:embed example2.txt
var example2 []byte
//go:embed input.txt
var input []byte
func TestExample(t *testing.T) {
is := is.New(t)
result, err := run(bytes.NewReader(example))
is.NoErr(err)
t.Log(result)
is.Equal(result.valuePT1, 161)
// result, err = run(bytes.NewReader(example2))
// is.NoErr(err)
// is.Equal(result.valuePT2, 48)
}
func TestSolution(t *testing.T) {
is := is.New(t)
result, err := run(bytes.NewReader(input))
is.NoErr(err)
t.Log(result)
is.True(result.valuePT1 < 186942148) // first attempt too high
is.Equal(result.valuePT1, 184122457)
//is.Equal(result.valuePT2, 0)
}