Add serializability to all the tests.

This is rather clunky. Will probably adjust the serialization
technique.