Debian Codegraph @

param_zero_checksum_test.go

raw
1 // SPDX-FileCopyrightText: 2026 The Pion community <https://pion.ly>
2 // SPDX-License-Identifier: MIT
3
4 package sctp
5
6 import (
7 "fmt"
8 "testing"
9
10 "github.com/stretchr/testify/assert"
11 )
12
13 func TestParamZeroChecksum(t *testing.T) {
14 tt := []struct {
15 binary []byte
16 parsed *paramZeroChecksumAcceptable
17 }{
18 {
19 binary: []byte{0x80, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01},
20 parsed: &paramZeroChecksumAcceptable{
21 paramHeader: paramHeader{
22 typ: zeroChecksumAcceptable,
23 unrecognizedAction: paramHeaderUnrecognizedActionSkip,
24 len: 8,
25 raw: []byte{0x00, 0x00, 0x00, 0x01},
26 },
27 edmid: 1,
28 },
29 },
30 }
31
32 for i, tc := range tt {
33 t.Run(fmt.Sprintf("%v", i), func(t *testing.T) {
34 actual := &paramZeroChecksumAcceptable{}
35 _, err := actual.unmarshal(tc.binary)
36 assert.NoError(t, err)
37 assert.Equal(t, tc.parsed, actual)
38 b, err := actual.marshal()
39 assert.NoError(t, err)
40 assert.Equal(t, tc.binary, b)
41 })
42 }
43 }