3 ms·
It's very useful when you're working on numerical software. Often, it's hard to figure out exactly what output your code should return (because if you knew the
by boscillator 2y ago
It's very useful when you're working on numerical software. Often, it's hard to figure out exactly what output your code should return (because if you knew the answer you wouldn't have to write the code), but you can easily list properties you expect.
- matt_d 2y agoRight, metamorphic testing in particular (which would be a special case of PBT, with metamorphic relations being properties), https://en.wikipedia.org/wiki/Metamorphic_testing https://en.wikipedia.org/wiki/Metamorphic_testing, https://github.com/MattPD/cpplinks/blob/master/testing.md#property-based-testing-metamorphic https://github.com/MattPD/cpplinks/blob/master/testing.md#pr... One simple example (from the above) is "sin (π − x) = sin x" for the implementation of the sine function not requiring the knowledge of its specific output values. Naturally, instead of the literal equality "=" one can use a more appropriate accuracy specification as in, say, relative ulp (https://en.wikipedia.org/wiki/Unit_in_the_last_place https://en.wikipedia.org/wiki/Unit_in_the_last_place) error bound, cf. https://members.loria.fr/PZimmermann/papers/accuracy.pdf https://members.loria.fr/PZimmermann/papers/accuracy.pdf