Testing, Benchmarking, and Profiling
Having tests and benchmarks for your code will help you in several ways. During development, tests ensure that what you are developing works and that you do not break existing functionality as part of your development work. Benchmarks ensure that your program stays within certain resource and time constraints. After the development is complete, the same tests and benchmarks will ensure that any maintenance work (bug fixes, feature enhancements, etc.) does not introduce bugs in existing functionality. So, you should consider writing tests and benchmarks as a core development activity, and develop both your program and its tests together.
Testing should focus on testing the expected behavior when everything works (“happy path testing”) as well as when things fail. It should not focus on testing all possible execution paths. Tests developed to exercise all possible implementation choices quickly become harder to maintain than the program...