more unit tests
merge with andrew
Merge remote-tracking branch 'origin/testsBozo'

While there also reorder some comments and ifdefs, etc. for
more logical layout and formatting consistency.