Improve testing by

* Having a "reference-output" directory which is matched against the
  test output
* Check that the log.json file is syntactically correct JSON.