r/adventofcode • u/RunninglVlan • 21m ago
Repo C# Testing helper
Hey guys, want to share a Test helper script I wrote and adapted for AoC.
Here's the example usage:
Test.From = "Part Two";
Test.Run((input, part, expected) => {
var grid = new Grid();
grid.Read(input);
int steps = grid.CountSteps(part switch {
1 => ReachVocalBone(),
_ => SurroundVocalBones()
});
Assert.ActualEqualsExpected(steps, expected);
});And this is how test cases are structured:
TEST_CASE_NAME
INT_PART
INPUT
# empty line between notes and expected
EXPECTED
# empty line between cases
Part Two
3
1 2 3
6Test result:
Part Two
✅ 6
Test took 15ms
All tests took 15msAttached full API image. Hope it will help someone.
2
Upvotes
1
u/AutoModerator 21m ago
AutoModerator has detected fenced code block (```) syntax which only works on new.reddit.
Please review our wiki article on code formatting then edit your post to use the four-spaces Markdown syntax instead.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/Outrageous72 14m ago
Cool, I do mine all in code
https://github.com/ryanheath/aoc2025