implement queue test, refactor code so compilation works, extract testutil code into separate file