chore: add day 10
All checks were successful
Go Test / build (pull_request) Successful in 19s

This commit is contained in:
xuu 2023-12-09 10:58:29 -07:00
parent 16a9afb2cb
commit d67ee5f3b6
4 changed files with 69 additions and 0 deletions

0
day10/example.txt Normal file
View File

0
day10/input.txt Normal file
View File

25
day10/main.go Normal file
View File

@ -0,0 +1,25 @@
package main
import (
"bufio"
"fmt"
aoc "go.sour.is/advent-of-code-2023"
)
func main() { aoc.MustResult(aoc.Runner(run)) }
type result struct {
valuePT1 uint64
valuePT2 uint64
}
func (r result) String() string { return fmt.Sprintf("%#v", r) }
func run(scan *bufio.Scanner) (*result, error) {
for scan.Scan() {
text := scan.Text()
_ = text
}
return &result{}, nil
}

44
day10/main_test.go Normal file
View File

@ -0,0 +1,44 @@
package main
import (
"bufio"
"bytes"
_ "embed"
"testing"
"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))
result, err := run(scan)
is.NoErr(err)
t.Log(result.valuePT1)
is.Equal(result.valuePT1, uint64(0))
t.Log(result.valuePT2)
is.Equal(result.valuePT2, uint64(0))
}
func TestInput(t *testing.T) {
is := is.New(t)
scan := bufio.NewScanner(bytes.NewReader(input))
result, err := run(scan)
is.NoErr(err)
t.Log(result.valuePT1)
is.Equal(result.valuePT1, uint64(0))
t.Log(result.valuePT2)
is.Equal(result.valuePT2, uint64(0))
}