2 ms·
Nope, it's better for properties to be statically proven by the compiler where possible, rather than tested with runtime tests. Tests should be used where you
by IshKebab 1y ago
Nope, it's better for properties to be statically proven by the compiler where possible, rather than tested with runtime tests.
Tests should be used where you can't prove correctness statically. But it's better if you can.
The ultimate end point of this is formal verification, where you need very few - if any - runtime tests. But formally verifying software is extremely difficult, so you can't usually do that.
- pjmlp 1y agoEven formal verification requires tests though, because there may be bugs on the logic proofs.
- IshKebab 1y agoTrue. Well usually. In some cases the property you're writing is so simple you wouldn't need any tests, for example in a compression library you just check decompress(compress(x)) == x. If that is proven there's no need for tests. But yeah usually it's a good idea to have a few tests anyway. You just need fewer tests the more properties you can prove formally.