Fix top_defaults() assuming that sources 'audio' and 'sim' exist.

Also added a regression test, and adjusted main() for testability.