github.com/pion/dtls/v2@v2.2.12/pkg/protocol/handshake/message_finished_test.go (about) 1 // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly> 2 // SPDX-License-Identifier: MIT 3 4 package handshake 5 6 import ( 7 "reflect" 8 "testing" 9 ) 10 11 func TestHandshakeMessageFinished(t *testing.T) { 12 rawFinished := []byte{ 13 0x01, 0x01, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 14 } 15 parsedFinished := &MessageFinished{ 16 VerifyData: rawFinished, 17 } 18 19 c := &MessageFinished{} 20 if err := c.Unmarshal(rawFinished); err != nil { 21 t.Error(err) 22 } else if !reflect.DeepEqual(c, parsedFinished) { 23 t.Errorf("handshakeMessageFinished unmarshal: got %#v, want %#v", c, parsedFinished) 24 } 25 26 raw, err := c.Marshal() 27 if err != nil { 28 t.Error(err) 29 } else if !reflect.DeepEqual(raw, rawFinished) { 30 t.Errorf("handshakeMessageFinished marshal: got %#v, want %#v", raw, rawFinished) 31 } 32 }