[PATCH] issue1610: Add tests for convert's topological sort algorithm

Martin Geisler mg at lazybytes.net
Mon Apr 20 18:13:16 CDT 2009


Patrick Mézard <pmezard at gmail.com> writes:

> Functional tests as we do them proved to be good enough:
>
> - They are self documenting. It's easy to see what they are testing,
>   easy to fix/update.

Not always, I don't find it particularly nice to look at the .out files
and try to guess which lines come from where. The diff helps a lot, but
a unit test would be more explicit.

> - They are easy to write (good for contributions), no need to know
>   unit test frameworks, and usually easier to setup than unit tests

I agree -- a big feature of the current system is simplicity.

But it also has some drawbacks, a major one being that the system is
very platform and tool dependent.

> - Being forced to exhibit behaviours without digging code internals
>   has a good effect on code design and instrumentation. It makes it
>   easier to diagnose problems since there are usually visible
>   side-effects.

Yeah, I guess one could say that it allows us greater freedom when
changing internal code. And it fits nicely with defining the Mercurial
API as the command line input/output.

> That said, unit tests also have good properties, like being usually
> faster to run.

Which is becoming increasingly important (I think the full test suite
takes about 12 minutes on my machine). Unit tests should help by
avoiding testing the same code again and again.

The current shell scripts create hundreds of repositories, add hundreds
of files, etc, but ideally these parts of the code should be tested by a
single unit test only, not several hundred tests like today.

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20090421/f3fbb76b/attachment.pgp 


More information about the Mercurial-devel mailing list