Possible solution for export : `unittest export`?

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Tue Sep 1 11:21:13 PDT 2015


On Tue, Sep 01, 2015 at 06:14:05PM +0000, deadalnix via Digitalmars-d wrote:
> On Tuesday, 1 September 2015 at 17:35:23 UTC, Jonathan M Davis wrote:
[...]
> >Yeah, any arguments which are basically saying that you need a
> >feature because you shouldn't have to have 100% code coverage is
> >going to fall flat with Walter and Andrei. All code that is released
> >should have 100% test coverage unless it has a really good reason why
> >it can't, and it's egg on the face of the developer who releases the
> >code without that - and no, we don't do a good enough job of that
> >with Phobos, and that _is_ egg on our face. We have good code
> >coverage, but we often don't have 100%, and when we don't, we miss
> >bugs. That test coverage needs to be there, and without it, it's far
> >too easy to release stuff that mostly works but falls apart in the
> >corner cases.
> >
> >So, if there's a feature that can be added which solves the export
> >problems that dicebot is talking about here, but it requires that you
> >unit test your code for it to catch everything, then so be it. I
> >really don't see that as an issue. If it can be done in a simple way
> >that doesn't require unit testing, then fine, but all of that code
> >should be fully unit tested anyway, so arguments based on the premise
> >that you shouldn't need to have full unit test coverage aren't going
> >to convince anyone - especially not the folks who would approve the
> >new feature.
> >
> >- Jonathan M Davis
> 
> No. That is very short sighted.
> 
> A ton of code is not unitestable. GUI as a starter. Random number
> generator.  Very rare events handling outside the control of the
> program. Concurent code. Etc...

That would explain why GUI apps tend to be buggy and unreliable, and
RNGs tend to have unintended biases.

No, actually, GUIs should be written to be testable (e.g., input should
be abstracted via dependency injection so that GUI interactions are
scriptable, at least inside a unittest, with expected final states).

RNGs can be unittested for uniform distribution within certain bounds.
Unittest does not necessarily mean checking for equality (even though
that's the most common usage).

You might be right about concurrent code, though. Unless you make it
possible to substitute CPU scheduler via dependency injection, it's
probably not unittestable.


T

-- 
May you live all the days of your life. -- Jonathan Swift


More information about the Digitalmars-d mailing list