Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,26 @@ AdventOfCode.Input.get!(7)
AdventOfCode.Input.delete!(7, 2019)
# and the next time you `get!` it will download a fresh one -- use this sparingly!
```


### Testing and Running your code

You can adjust your test to reflect the sample provided at the challenge description. And run your tests:
```bash
mix test --only y2024.d01.p1
mix test --only y2024.d01
mix text --only y2024
```

This syntax is pretty straight forward, the first one will run the test for a particular part, the second will run all the tests for that day, and the third one for the year.

As you progress with the challenge you'll find edge cases, and you can create your own tests for that and even reuse some of those tags.

When you're done with testing you can run your code with the command:
```bash
mix y2024.d01.p1
```

The identification of the task to run your code and the name of the test follows the same structure, so it's easy to move between those.


7 changes: 4 additions & 3 deletions lib/mix/tasks/advent.generate.day.ex
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,19 @@ defmodule Mix.Tasks.Advent.Generate.Day do
test_module_name,
"""
use ExUnit.Case

import #{day_module_name}
@moduletag :"y#{year}.d#{full_day_number}"
@moduletag :y#{year}

@tag :skip
@tag :"y#{year}.d#{full_day_number}.p1"
test "part1" do
input = nil
result = part1(input)

assert result
end

@tag :skip
@tag :"y#{year}.d#{full_day_number}.p2"
test "part2" do
input = nil
result = part2(input)
Expand Down