Refactor some test code
Merge https://github.com/ratboy666/snolib