Unit tests for -serialize