gobanos/cargo-aoc

Suggestion: Check solutions

ThomasdenH opened this issue · 2 comments

It would be nice to have some way of checking the solutions are still correct after a refactor. Maybe in the form of a output file in the input directory. Solutions would be supplied by the user and only checked when present.

Hi Thomas!

As per the README:

you can have multiple implementation for the same part of a day. You must then use a name to tag them correctly, for example : #[aoc(day2, part1, for_loop)].

The current way to do this is to implement two solutions for the same part, tagged differently. The user can then check that both solutions return the same value.

If by "solutions", plural form, you meant checking for the samples given in the problem, IMHO it is up to the user to unit-test their implementation correctly using Cargo's tools. The main reason behind this is that "comparing the solutions" is often a non-trivial task, and solutions returned by your implementation may not always be just numbers or strings, e.g. AOC 2018 Day 10. Therefore, cargo-aoc cannot provide a generic way to do this.

Allright.