Started some unit tests.

This is still very incomplete. Also, one of the tests is only
half-written, and is thus failing.