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