August 05, 2016
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

August 05, 2016
On 8/5/2016 12:10 PM, Jonathan M Davis via Digitalmars-d wrote:
> [...]

Yes, I pretty much agree with your entire post.

August 05, 2016
On Friday, August 05, 2016 14:10:02 Walter Bright via Digitalmars-d wrote:
> On 8/5/2016 12:10 PM, Jonathan M Davis via Digitalmars-d wrote:
> > [...]
>
> Yes, I pretty much agree with your entire post.

I just wish that you'd agree that issues like these

https://issues.dlang.org/show_bug.cgi?id=14855 https://issues.dlang.org/show_bug.cgi?id=14856 https://issues.dlang.org/show_bug.cgi?id=14857

should be fixed so that the code coverage metrics would be more accurate. :) Without those fixes, most of the code that I write will never have 100% code coverage even if the tests do test everything and test it very throughly.

- Jonathan M Davis

1 2 3
Next ›   Last »