5 ms·
OK, I see your point. Of course, the type system will not substitute this kind of tests. But it allows you to check the whole range of values. This is helpful i
by solarexplorer 12y ago
OK, I see your point. Of course, the type system will not substitute this kind of tests. But it allows you to check the whole range of values. This is helpful if you e.g. wanted to handle overflows, wanted to limit the operands to positive numbers, etc.
- mpweiher 12y agoNot only will the type-system not substitute these types of tests, but also the reverse: you just don't write tests for types, as they are subsumed by the value tests, which is why I object to the canard of "the type system saves you from having to write trivial tests for types". And yes, a type-system can do certain types of "forall" analyses that are difficult or impossible with tests, but that's a different topic.
- NickPollard 12y agoIt's also more important. Generally with tests, you're less concerned about having some particular examples succeed, than you are with finding if there are possible values that fail.
- pjmlp 12y agoThe fallacy is assuming people write tests. Regardless of what gets preached at agile conferences and such, the reality is that in most enterprise projects, the amount of tests is close to zero.
- the_af 12y ago> you just don't write tests for types, as they are subsumed by the value tests I think this is false.