Add some tests and cleanup

Signed-off-by: Stéphane HULARD <s.hulard@chstudio.fr>