Added a bunch of unit tests (incomplete)

Signed-off-by: Richard Bagshaw <richard@bagshaw.co.uk>