Re-organise tests, add command line tool tests