Skip to content

Latest commit

 

History

History
144 lines (102 loc) · 2.17 KB

aoc_template.livemd

File metadata and controls

144 lines (102 loc) · 2.17 KB

Advent of Code - Day 04

Mix.install([
  {:kino_aoc, "~> 0.1"}
])

Setup

{:ok, puzzle_input} =
  KinoAOC.download_puzzle("2023", "4", System.fetch_env!("LB_AOC_SESSION"))
defmodule Parser do
  def parse(input) do
  end
end
ExUnit.start(autorun: false)

defmodule ParserTest do
  use ExUnit.Case, async: true
  import Parser

  @input ""
  @expected nil

  test "parse test" do
    actual = parse(@input)
    assert actual == @expected
  end
end

ExUnit.run()

Part One

Code

defmodule PartOne do
  def solve(input) do
    IO.puts("--- Part One ---")
    IO.puts("Result: #{run(input)}")
  end

  def run(input) do
  end
end

Tests

ExUnit.start(autorun: false)

defmodule PartOneTest do
  use ExUnit.Case, async: true

  @input """
  """
  @expected nil

  test "part one" do
    actual = PartOne.run(@input)
    assert actual == @expected
  end
end

ExUnit.run()

Solution

PartOne.solve(puzzle_input)

Part Two

Code

defmodule PartTwo do
  def solve(input) do
    IO.puts("--- Part Two ---")
    IO.puts("Result: #{run(input)}")
  end

  def run(input) do
  end
end

Tests

ExUnit.start(autorun: false)

defmodule PartTwoTest do
  use ExUnit.Case, async: true
  import PartTwo

  @input """

  """
  @expected nil

  test "part two" do
    actual = run(@input)
    assert actual == @expected
  end
end

ExUnit.run()

Solution

PartTwo.solve(puzzle_input)