Test case explosion

Dramatically expanded the test case coverage, which in turn caught 3 bugs in the port.

This supersedes #4