18 ms·
If I understand correctly, tests are for what the code should do. There is some business logic and you are asserting that the business logic does what it should
by alexpetralia 5y ago
If I understand correctly, tests are for what the code should do. There is some business logic and you are asserting that the business logic does what it should do (the test). If you manipulate the business logic, and it no longer does what the test says the code should do, the test fails.
Here it is not as clear what the code should do. What should the amount of excess deaths be? In what ways would we change the logic such that the test case would break? If the input data set is static, isn't it more like a mock anyway?
I think for this reason you often see more sanity checks in research code because the should case is not as clearly defined.
- stonemetal12 5y ago>What should the amount of excess deaths be? With several fake known inputs and there associated outputs we should be able to determine if the calculation is right. The result on the real world data is not known but when calculating a statistic you should be able to figure out if you are calculating the right statistic or returning 42 for all inputs.