logoalt Hacker News

mysterydip • today at 12:54 PM • 1 reply • view on HN

I was reviewing some coordinate conversion code one time and a developer’s method of creating unit tests was to run their code, generate a result, then make that output the correct result for the test. Except the result was wrong based on other utilities doing the same conversion, and also failed edge cases.


Replies

thargor90 • today at 1:45 PM

For the inexperienced dev audience: generally speaking that is a valid way to generate regression tests and document novel edge case behavior.

In your case of course any existing utilities behavior/specs should be tested first, regression tests just on top, if they are not already covered.