Better HN
topnewbestaskshowjobs
Log inSign up

jar

1 karma · joined Aug 23, 2010 (16y ago) · 1 submissions

Submissions

comment 16y ago · link · parent

A better way to handle this would be to take a set of inputs, run it through the function and then hand-inspect (or use some other tool to check) that the results make sense. Store the inputs and outputs in a CSV file.

Now, every time you run the test you should read in this file and compare the results that you get running the function with the results contained in that file (which were already verified to be correct.)

This doesn't ensure that the calculations are done correctly, but it does ensure that after future code changes the output remains consistent.