Write a chokfull of... Test code

And there isn't even an actual test yet.

Signed-off-by: Francis Galiegue <fgaliegue@gmail.com>