Test structure: Organizing your tests (so you can find them later)
Navigating a disorganized codebase is about as pleasant as cleaning out the office fridge.
You might find something interesting, but it's probably going to smell. The same goes for your tests. Without proper structure, you'll spend more time searching for that elusive test case than actually fixing the bug it uncovered.
So, let's channel our inner Marie Kondo and bring some order to your testing chaos.
The art of keeping tests close
In Zig, the prevailing philosophy is to keep your tests close to the code they validate. This approach not only fosters better organization but also ensures that tests and code evolve together in perfect (or at least tolerable) harmony.
Writing your tests in the same file as the code under test is a practice that encourages cohesion and clarity. Here is a snippet with the source code and its tests living along: