package protocol import "testing" func TestRCFrameRoundTrip(t *testing.T) { input := RCFrame{Sequence: 42, Timestamp: 123456} for i := range input.Channels { input.Channels[i] = int16(i*100 - 750) } got, err := DecodeRC(EncodeRC(input)) if err != nil { t.Fatal(err) } if got != input { t.Fatalf("round trip mismatch: got %#v want %#v", got, input) } } func TestRCFrameRejectsBadCRC(t *testing.T) { packet := EncodeRC(RCFrame{}) packet[Header] ^= 1 if _, err := DecodeRC(packet); err == nil { t.Fatal("expected CRC error") } }