3 ms·
Separate reply for the n-dimensional testing space: This goes back to the scientific method and hypothesis-testing. When conducting experiments in school, we l
by syndicatedjelly 3y ago
Separate reply for the n-dimensional testing space:
This goes back to the scientific method and hypothesis-testing. When conducting experiments in school, we learned to have only one independent variable at a time, and measure its singular effect on the dependent variable. It's possible to test more variables at once - it's just hard to visualize, more time-consuming, and more difficult to plot nicely in a school report. Using an idea from statistics called Design of Experiments, one can change two variables at once, creating a 3-dimensional space with a 3-dimensional functions.
Anyway, what's this have to do with programming? A program is effectively a transformation of inputs into outputs. It's easier to think about this for an individual function
fun (a int, b int) -> int { ...stuff... }
There are a few ways to test this function. The first is think really hard about common inputs, and make sure the outputs are correct. The next level is to figure out all the edge cases and test those as well. At that point, that function would be considered reasonably well-tested.
But why is that? Why doesn't 100% test coverage mean someone tested EVERY SINGLE POSSIBLE INPUT?
Because that style of testing has produced a series of points of data through which a 2d curve can be traced through the 3d test space (because there are 2 independent variables (a and b) and the dependent output). As a result, one can interpolate any value within that curve and know what the output is.
This example is clearly very simplified, but the concept can be extrapolated to functions with more complicated inputs and entire programs.
Reference: https://en.wikipedia.org/wiki/Design_of_experiments https://en.wikipedia.org/wiki/Design_of_experiments