Factorize code for tests.
Merge pull request #7 from bchretien/master

Factorize code for tests.