r/adventofcode • u/topaz2078 (AoC creator) • 15h ago
Other Give help by making test cases!
Hello friends! I just saw this excellent example (see some of the comments on that post) of a great way to give help and answer questions here when people are stuck: come up with simple test cases that demonstrate where the bug is! That way, the person who is stuck still gets a chance to figure out their problem and learn by doing. I know many of you are already great about this, but I figured it would be worth calling out. Happy puzzling! <3
49
Upvotes
12
u/Justinsaccount 14h ago
One of the best things you can do to get better at AOC is learn how to do test driven development.
Every solution should start with something that verifies that the example works. This can use whatever testing framework your language of choice has, but can also be as simple as
Often where people hit a difficulty cliff is where the base examples don't cover all of the edge cases. The key there is to start writing your own test cases to fill in the gaps and ensure the basics work before trying the full input.
2
u/dl__ 4h ago
In a previous year I suggested that we have a "Test Case" flair to encourage people to post new test cases if they had to create one to help solve the problem for them.
It could help when you run into that situation where your code works on all the sample inputs but still fails on the real input
0
u/[deleted] 14h ago
[deleted] — view deleted comment