Add tests for serialize()