From d67ee5f3b6cb2be12fc65a7290359169cf824b90 Mon Sep 17 00:00:00 2001 From: xuu Date: Sat, 9 Dec 2023 10:58:29 -0700 Subject: [PATCH] chore: add day 10 --- day10/example.txt | 0 day10/input.txt | 0 day10/main.go | 25 +++++++++++++++++++++++++ day10/main_test.go | 44 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+) create mode 100644 day10/example.txt create mode 100644 day10/input.txt create mode 100644 day10/main.go create mode 100644 day10/main_test.go diff --git a/day10/example.txt b/day10/example.txt new file mode 100644 index 0000000..e69de29 diff --git a/day10/input.txt b/day10/input.txt new file mode 100644 index 0000000..e69de29 diff --git a/day10/main.go b/day10/main.go new file mode 100644 index 0000000..8f291c9 --- /dev/null +++ b/day10/main.go @@ -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 +} diff --git a/day10/main_test.go b/day10/main_test.go new file mode 100644 index 0000000..687a19e --- /dev/null +++ b/day10/main_test.go @@ -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)) +}