Collapse repeated test code.
Merge pull request #16 from monde/master

Collapse repeated test code.