This commit is contained in:
parent
16a9afb2cb
commit
d67ee5f3b6
0
day10/example.txt
Normal file
0
day10/example.txt
Normal file
0
day10/input.txt
Normal file
0
day10/input.txt
Normal file
25
day10/main.go
Normal file
25
day10/main.go
Normal 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
44
day10/main_test.go
Normal 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))
|
||||
}
|
Loading…
Reference in New Issue
Block a user