From 13888edaff45c4ca515cc22055ea12124b6fb189 Mon Sep 17 00:00:00 2001 From: xuu Date: Wed, 20 Dec 2023 11:27:54 -0700 Subject: [PATCH] chore: start day20 --- day20/example.txt | 0 day20/input.txt | 0 day20/main.go | 30 ++++++++++++++++++++++++++++++ day20/main_test.go | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+) create mode 100644 day20/example.txt create mode 100644 day20/input.txt create mode 100644 day20/main.go create mode 100644 day20/main_test.go diff --git a/day20/example.txt b/day20/example.txt new file mode 100644 index 0000000..e69de29 diff --git a/day20/input.txt b/day20/input.txt new file mode 100644 index 0000000..e69de29 diff --git a/day20/main.go b/day20/main.go new file mode 100644 index 0000000..c0596d8 --- /dev/null +++ b/day20/main.go @@ -0,0 +1,30 @@ +package main + +import ( + "bufio" + _ "embed" + "fmt" + + aoc "go.sour.is/advent-of-code" +) + +// var log = aoc.Log + +func main() { aoc.MustResult(aoc.Runner(run)) } + +type result struct { + valuePT1 int + valuePT2 int +} + +func (r result) String() string { return fmt.Sprintf("%#v", r) } + +func run(scan *bufio.Scanner) (*result, error) { + + for scan.Scan() { + _ = scan.Text() + + } + + return &result{}, nil +} diff --git a/day20/main_test.go b/day20/main_test.go new file mode 100644 index 0000000..b55d509 --- /dev/null +++ b/day20/main_test.go @@ -0,0 +1,41 @@ +package main + +import ( + "bufio" + "bytes" + "testing" + + _ "embed" + + "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) + is.Equal(result.valuePT1, 0) + is.Equal(result.valuePT2, 0) +} + +func TestSolution(t *testing.T) { + is := is.New(t) + scan := bufio.NewScanner(bytes.NewReader(input)) + + result, err := run(scan) + is.NoErr(err) + + t.Log(result) + is.Equal(result.valuePT1, 0) + is.Equal(result.valuePT2, 0) +}