Initial tests added.

There are boatloads more tests that need to be added, but these
have already turned up a significant bug.
Fix .keys so the first key isn't skipped.