Skip to content

Instantly share code, notes, and snippets.

@marpo60
Last active December 1, 2022 21:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marpo60/bcf7dd45003adfe01b5581d03157a5de to your computer and use it in GitHub Desktop.
Save marpo60/bcf7dd45003adfe01b5581d03157a5de to your computer and use it in GitHub Desktop.
Advent of Code 2022 - Livebook Template

AOC 2022 - Day 1

Puzzle description

Day 1: Calorie Counting.

Input

defmodule Load do
  def input do
    File.read!("day1.txt")
  end
end

Solution

defmodule Part1 do
  def run(input) do
   ###
  end
end

defmodule Part2 do
  def run(input) do
  ###
  end
end

ExUnit.start(autorun: false)

defmodule Test do
  use ExUnit.Case, async: true
  @example_input ~s(
1000
2000
3000

4000

5000
6000

7000
8000
9000

10000
)
  @input Load.input()

  test "part 1 example" do
    assert Part1.run(@example_input) === 24000
  end

  test "part 1" do
    assert Part1.run(@input) === 0
  end

  test "part 2 example" do
    assert Part2.run(@example_input) === 45000
  end

  test "part 2" do
    assert Part2.run(@input) === 0
  end
end

ExUnit.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment