Re:Advent of Code 2021
by thom on Sunday November 21, 2021 @04:30AM
(#29295140)
Tried this properly for the first time last year, and very much enjoyed doing each task 'properly' with literate programming, unit tests, benchmarks for different implementations etc. It was extremely soothing, much more so than if I'd just tried to solve each problem as quickly as possibly. I'm sure some others would get a lot out of this approach, whether or not you're trying a new language.
[ Parent
| on HN ]
> unit tests
Don't you need a way to generate more inputs in addition to the one you have?
Every puzzle comes with example inputs and expected outputs. Those inputs are much smaller than the puzzle input, but if you get the example inputs and expected outputs right then you are probably most of the way there.
Basically every puzzle comes with unit tests that just need to be translated into code.
Yup, although I do enjoy finding edge cases that aren’t necessarily present in the examples or input. I intend to do a fair bit more property-based testing this year, just for kicks. That’s something I’ve had success with for raw algorithmic code but struggled with in the past for nitty-gritty real-world use cases.
Those would be functional tests
Re:Advent of Code 2021
by jacobmischka on Sunday November 21, 2021 @07:08AM
(#29295779)
Same thing if your whole solution is a single function :)
Re:Advent of Code 2021
by NoahTheDuke on Sunday November 21, 2021 @10:28AM
(#29296828)
Which is another name for unit tests.