Very late post-release attempt at advent of code 2024 in Rust.
I am teaching myself Rust, so these are not ideal or reference solutions by any stretch of the imagination.
Day | Challenge | Status |
---|---|---|
1 | --- Day 1: Historian Hysteria --- | ⭐ ⭐ Complete |
2 | --- Day 2: Red-Nosed Reports --- | In Progress |
This is a very casual attempt, I'll just be trying random tasks as I get enthusiastic.
- This is about having fun, challenging myself and learning new things.
- I will almost definitely skip days, and am encouraging myself to do it when it's impacting my sanity (See Rule #1).
- I can use what ever tools I want within rust. This is a learning experience around the whole ecosystem for me.
- I will not look at any reference solutions to the tasks.
- I can research ways of efficiently solving general problems required by the task provided it doesn't conflict with Rule #4.
The project is structured with each days solutions being placed in modules in the root crate, src\dayxx
.
Test data is included in the same directory:
- `example.txt" - Example data from the question for verifying solutions with (usually just during development).
data.txt
- The data I was provided for the task.
There is also a helper crate aoc-lib
, which just contains some general functionality for loading data, and provides macros for pretty displays during testing.
Bundled unit-tests
Each module contains rstest
inline parametrized unit tests for verifying the results of the solutions against my verified results.
These can be called with cargo test --all --
, you can add --nocapture --test-threads=1
if you to display results for the solutions.
The unit tests borrow solution values for the actual task from constants defined in the systems tests limits /tests/test_limits
.
This is so they can be shared between the two test suites.
The crate also builds to a CLI interface for calling the solutions on arbitrary data input (note the files must be named and formatted the same as ones in my source.).
Advent of Code Runner
Usage: aoc-2024.exe --day <DAY> --part <PART> --data <DATA>
Options:
-d, --day <DAY> Which day to run
-p, --part <PART> Which part to run
-d, --data <DATA> Path to the input file
-h, --help Print help
-V, --version Print version
Example:
aoc-2024.exe --day=1 --part=1 --data=src/day01/data.txt
🧩 Output: 1319616
Systems Test
In the tests/
directory there are systems level tests against the CLI runner, to ensure unit tests solutions are reproducible via the binary.
These can be run manually with cargo test --test=system
.
The source of this repo uses the MIT open-source license, for details on the current licensing see LICENSE.md or click the badge above.
- Copyright 2025 © NullTek.