News for hackers. Stuff that matters.
Re:The tragedy of 100% code coverage (2016) by ubernostrum on Tuesday May 09, 2017 @02:55AM (#14298203)
I only have one piece of code for which I can say true 100% coverage exists: a library that works with HTML/CSS color values, and which ships a test that generates all 16,777,216 hexadecimal and integer rgb() color values, and runs some functions with each value.

However, I don't run that as part of the normal test suite. It only gets run when I'm prepping a new release, as a final verification step; the normal runs-every-commit test suite just exercises with a selection of values likely to expose obvious problems.

Re:The tragedy of 100% code coverage (2016) by voidpointer on Tuesday May 09, 2017 @07:30AM (#14299084)
Just out of curiosity... What is the point in testing all 2^24 possible color values?
Re:The tragedy of 100% code coverage (2016) by ubernostrum on Tuesday May 09, 2017 @09:55PM (#14305381)
The point is being certain I haven't missed an edge case somewhere.

The hard part is the percentage rgb() values, of which there are technically an uncountably infinite number (since any real number in the range 0-100 is a legal percentage value). For those I generate all 16,777,216 integer values, and verify that converting to percentage and back yields the original value.

Re:The tragedy of 100% code coverage (2016) by dahauns on Tuesday May 09, 2017 @05:17AM (#14298638)
Hmm...true 100% input coverage? Including the time domain? (Order dependency, Idempotence, etc...) :)
Re:The tragedy of 100% code coverage (2016) by LgWoodenBadger on Tuesday May 09, 2017 @09:20AM (#14299733)
how do you know the test that generates those values is correct?
Re:The tragedy of 100% code coverage (2016) by ubernostrum on Tuesday May 09, 2017 @09:55PM (#14305382)
Python's test suite.
Re:The tragedy of 100% code coverage (2016) by test1235 on Tuesday May 09, 2017 @04:34AM (#14298512)
How long does that take?
Re:The tragedy of 100% code coverage (2016) by ubernostrum on Tuesday May 09, 2017 @09:56PM (#14305386)
Depends on the machine. See the comments in the file:

https://github.com/ubernostrum/webcolors/blob/master/tests/f...

The fun part is people who criticize the generation of the integer triplets; yes, it's three nested loops and that's bad, but the total number of iterations will always be 16,777,216 no matter what algorithm you decide to use to generate them. So it uses nested loops since that's the most readable way to do it.