Let's say we have function A
and function B
which perform consecutive operations on some data, with B
never receiving the data before A
processes it.
Function A
makes exhaustive checks on potential errors on the input data. For A
, it's a no-brainer to write proper unit tests. Should there also be tests written for B
? If it's given invalid data in tests, it crashes, but if there are checks in place there's a performance loss.