Advent of Code runner
We assume that:
- Your code is written in Python 3.
- Program filename is
<part>.py
(e.g. part 1:1.py
) - Live input is
<part>.txt
(e.g. part 1:1.txt
) - Live output is
<part>.out.txt
(e.g. part 1:1.out.txt
) - All test cases input must be of the format
t<part>{suffix}.txt
, where suffix can be optional (e.g. part 1 can havet1.txt
ort1.1.txt
) - All test cases output must be of the format
t<part>{suffix}.out.txt
, where suffix can be optional (e.g. part 1 can havet1.out.txt
ort1.1.out.txt
)
Note that live input/output means your actual inputs/outputs for the problem. You can also have as many test cases as you want, but we only handle 1 live input.
No official crate release for now; this must be compiled and installed manually:
git clone https://github.com/yamgent/aoc.git
cd aoc
cargo install --path .
All examples below assume you want to run part 1.
aoc run 1
For example, to run for my_input.txt
:
aoc run 1 my_input
aoc write 1
For example, to run for my_input.txt
and get my_input.out.txt
:
aoc write 1 my_input
Note that both pairs of input and output must exist (pairs are determined
by t<part>{suffix}
, so t1.1.txt
pairs with t1.1.out.txt
), otherwise
the test case will also fail.
Optionally, if live input/output pair exists, this pair will also be tested.
aoc test 1
For example, to test input my_test.txt
and expected output my_test.out.txt
:
aoc test 1 my_test
In case you want to view the output, you can use the --diff
option:
aoc test 1 --diff
We use Rust + cargo for main development, Python 3 for system testing.
For debugging/building:
cargo run
cargo build
For system testing (run in main directory):
python3 testing/system_test.py