Refactor serialization tests to improve reusability

Also, improve test coverage for the RevTree serialization code.