General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
ThePrimeTime
comments
Comments by "" (@diadetediotedio6918) on "The Lies Of 100% Code Coverage | Prime Reacts" video.
The funny thing for me is that your assumption that we should aim to test for every possible situation would be functionally equivalent to saying we should aim for solving the halting problem. Objective tests are almost always better than aiming for something you cannot predict, and there are things we do know for sure that will work and thus testing is a loss of time.
2
To be fair, I would think* it is strange for prime to shout about this and to use unit test functions like 'eq' in his own tests, a thing that is functionally equivalent to just throwing (because usually this is how these functions are implemented under the hood).
1
@Mystic998 No, really. The eq he is using is only checking against 'true', you can clearly see it in the code. The throw if negative thing is a microsoft construct, it is a C# thing (and it is enforced by the linter in new versions), so I don't think it is out of pattern or 'inconsistent' (as if inconsistency would be necessarily a problem anyway, another misleading assumption). And by the way, you can look at the source code for this method. The ThrowIfNegative has a bunch of little things stacked together that would make a very long line of code. For example, it uses generic number contracts for checking against negatives (so it can work even with custom types), it also uses localized and formatted errors in the exception part.
1