github.com/pion/dtls/v2@v2.2.12/pkg/protocol/extension/supported_point_formats_test.go (about)

     1  // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
     2  // SPDX-License-Identifier: MIT
     3  
     4  package extension
     5  
     6  import (
     7  	"reflect"
     8  	"testing"
     9  
    10  	"github.com/pion/dtls/v2/pkg/crypto/elliptic"
    11  )
    12  
    13  func TestExtensionSupportedPointFormats(t *testing.T) {
    14  	rawExtensionSupportedPointFormats := []byte{0x00, 0x0b, 0x00, 0x02, 0x01, 0x00}
    15  	parsedExtensionSupportedPointFormats := &SupportedPointFormats{
    16  		PointFormats: []elliptic.CurvePointFormat{elliptic.CurvePointFormatUncompressed},
    17  	}
    18  
    19  	raw, err := parsedExtensionSupportedPointFormats.Marshal()
    20  	if err != nil {
    21  		t.Error(err)
    22  	} else if !reflect.DeepEqual(raw, rawExtensionSupportedPointFormats) {
    23  		t.Errorf("extensionSupportedPointFormats marshal: got %#v, want %#v", raw, rawExtensionSupportedPointFormats)
    24  	}
    25  }