On Thursday, August 04, 2016 19:37:35 Walter Bright via Digitalmars-d wrote: > In adding some overflow detection to Phobos, I discovered that some > allocations were never called by the unittests. Adding a unittest for those > paths, I discovered those paths didn't work at all for any cases. > > I'm not giving up coverage testing anytime soon, regardless of what some > study claims :-)
Well, like you said in the previous post, code coverage is important but it's not sufficient. It's always a bad sign when the code coverage isn't 100% (which is part of why we'd like the metrics to actually be accurate), but while testing everything is a huge step in the right direction, you have to have thorough tests to actually verify that the code behaves correctly. And since you can never test everything, it does become a bit of an art to figure out how to sufficiently test a function without going overboard. Too many folks don't test sufficiently IMHO, but then again, I probably tend to go overboard. Still, I've found that being very thorough with unit tests seriously reduces the number of bugs (e.g. very few bugs have ever been reported for std.datetime). Regardless, the fact that D has unit testing built in is a huge win, and even if too many folks don't test their code thoroughly, the fact that it's so easy to add tests to your program makes it embarassing when they don't do at least _some_ testing, and that improves the quality of D code overall even if there's still plenty of code that isn't necessarily at the level of quality that we'd like. - Jonathan M Davis