github.com/pion/dtls/v2@v2.2.12/pkg/protocol/extension/supported_elliptic_curves_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 TestExtensionSupportedGroups(t *testing.T) {
    14  	rawSupportedGroups := []byte{0x0, 0xa, 0x0, 0x4, 0x0, 0x2, 0x0, 0x1d}
    15  	parsedSupportedGroups := &SupportedEllipticCurves{
    16  		EllipticCurves: []elliptic.Curve{elliptic.X25519},
    17  	}
    18  
    19  	raw, err := parsedSupportedGroups.Marshal()
    20  	if err != nil {
    21  		t.Error(err)
    22  	} else if !reflect.DeepEqual(raw, rawSupportedGroups) {
    23  		t.Errorf("extensionSupportedGroups marshal: got %#v, want %#v", raw, rawSupportedGroups)
    24  	}
    25  }