Add unit tests. All pass or are marked as TODO.