Is phobos too fluffy?
H. S. Teoh
hsteoh at quickfur.ath.cx
Fri Sep 18 14:19:46 UTC 2020
On Fri, Sep 18, 2020 at 12:05:39PM +0000, Imperatorn via Digitalmars-d wrote:
> On Friday, 18 September 2020 at 07:41:25 UTC, mw wrote:
> > On Friday, 18 September 2020 at 06:50:48 UTC, Imperatorn wrote:
> > > Not to criticize, but, if it has reached 330 KLOC there might be
> > > another problem :S
> > >
> > > How did it get that big?
> > Sometimes for non-trivial program, `unittest` can easily be longer
> > than the program itself to cover all the test paths & cases.
> Sure, but wouldn't you separate the code and tests in different
Why would you? Keeping tests and code side-by-side makes it more likely
that the two are in sync, and therefore that the tests are relevant to
the current version of the code. The larger the separation, the more
likely the two are out-of-sync, which in practice usually means the
tests become largely irrelevant and fail to test significant
functionality, and code quality drops. Keeping tests in a separate
module or a separate project altogether exacerbates this likelihood.
Keeping them right next to the function being tested increases the
chances of being relevant.
Besides, you really should be writing tests alongside the code as you're
coding anyway. IME, doing that has a high chance of catching bugs early
and increasing code quality as a result. Postponing the writing of
tests, or having to switch to a different file/project to write the
test, makes it less likely tests will be written in the first place, and
more likely that the tests will be general and fail to cover corner
Doubtless it is a good thing to have an open mind, but a truly open mind should be open at both ends, like the food-pipe, with the capacity for excretion as well as absorption. -- Northrop Frye
More information about the Digitalmars-d