Re-factor and simplify tests, fix, etc ...

This is a first step towards making it work for multiple versions of libmagic.

Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>