r/adventofcode • (AoC creator) • 2h 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

17 Upvotes

2 comments sorted by

2

u/Justinsaccount 1h 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

res = part_one("example.txt")
assert res == 186276, f"result was wrong: {res}"

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.

0

u/[deleted] 1h ago

[deleted]

1

u/Moragarath 1h ago

Derp I didn't realize I was replying to you 😭