Original tests by João Barbosa <joao.paulo.barbosa@gmail.com> Additional contribution by John Newbery <john@johnnewbery.com>