Add roundtrip encoding/decoding tests for samples