Compare commits

...

1 Commits

Author SHA1 Message Date
xuu
883c0e69e1
chore: add day 10
Some checks failed
Go Test / build (pull_request) Failing after 20s
2023-12-09 10:58:29 -07:00
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))
}