Encoder Test Code