The yearly attempt at consistency with coding as a hobby!
src/main.rs
: only running commands from the librarysrc/lib.rs
: importing daily challenges and utilssrc/utils.rs
: helpers to read the input file, adn other functionsresources/input/
: where the input files are locatedsrc/days/day*.rs
: daily challenge sokution
- Each helper is tested
- Tests are made from the daily puzzle examples to test the puzzle solution on a known result
cargo test -- --nocapture
to run the test suite
To start a new daily puzzle:
- Write the input example in
resources/input
- Write the input in
resources/input
- Copy a previous day file in
src/days
- Import the new file as a module in
src/days/mod.rs
- Add it and run it in
src/main.rs
Now in your daily puzzle file:
- Remove all that is result2 and test_result2
- In test_result1, add the correct sample input and the expectation described in the puzzle instructions
- in the result1 function, remove the content and return 0
- Run
cargo test -- --nocapture
the test should fail - Now, solve the puzzle in result1
- Test against the sample input and result again
- Fix and improve until the test passes
- Run the actual data with
cargo run
- Send your answer
- Repeat for the 2nd puzzle