Ask HN: How do you test validity of input data of an algorithm?
We are writing a service which obtains data trough a REST API and passes it to an algorithm (nothing special).
The problem which I am facing is that as several people are involved into the development I need to standardise how to test for validity of the input data. Should we:
* test it thoroughly on input * test it in the algorithm implementation * test it on both places
In the first case the algorithm assumes that the data is valid. * you might miss something
In the second the algorithm handles all the error handling * the code gets more messy and it is harder to write tests
In the third it is harder to specify what can happen if you the algorithm is used without directly without the API call and validity check...
How would you design it?
0 comments
[ 3.4 ms ] story [ 12.4 ms ] threadNo comments yet.