3 ms·
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 resul
by jar 16y ago
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.