On Fri, Dec 05, 2014 at 12:35:50PM -0800, Walter Bright via Digitalmars-d wrote: > On 12/5/2014 8:36 AM, H. S. Teoh via Digitalmars-d wrote: > >As with all things, I'm skeptical of blindly applying some > >methodology even when it's not applicable or of questionable benefit. > > In general I agree with you, but for unittests a methodology of using > it with a coverage analyzer to ensure all code paths are executed is > extremely effective. > > I just found two bugs in dmd's lexer.c merely by writing tests to > cover unexercised code. > > https://github.com/D-Programming-Language/dmd/pull/4191
Yes, and earlier this week I found a bug in version.c just by trying to increase code coverage with test cases. :-) The kind of blind application of methodology I had in mind was more along the lines of "OK so I'm required to write unittests for everything, so let's just pad the tests with inane stuff like 1+1==2, or testing that the function's return value equals itself, 'cos it's Friday afternoon and I wanna go home". T -- "Hi." "'Lo."