Improved tests

Compare stdout from tests to expected output, and throw on discrepancies; this allows better travis support.

Tests before this PR just exit with code 0.