File: chunktype_test.go

package info (click to toggle)
golang-github-pion-sctp 1.8.6-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports, sid, trixie
  • size: 888 kB
  • sloc: makefile: 13
file content (34 lines) | stat: -rw-r--r-- 810 bytes parent folder | download
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
package sctp

import "testing"

func TestChunkType_String(t *testing.T) {
	tt := []struct {
		chunkType chunkType
		expected  string
	}{
		{ctPayloadData, "DATA"},
		{ctInit, "INIT"},
		{ctInitAck, "INIT-ACK"},
		{ctSack, "SACK"},
		{ctHeartbeat, "HEARTBEAT"},
		{ctHeartbeatAck, "HEARTBEAT-ACK"},
		{ctAbort, "ABORT"},
		{ctShutdown, "SHUTDOWN"},
		{ctShutdownAck, "SHUTDOWN-ACK"},
		{ctError, "ERROR"},
		{ctCookieEcho, "COOKIE-ECHO"},
		{ctCookieAck, "COOKIE-ACK"},
		{ctCWR, "ECNE"},
		{ctShutdownComplete, "SHUTDOWN-COMPLETE"},
		{ctReconfig, "RECONFIG"},
		{ctForwardTSN, "FORWARD-TSN"},
		{chunkType(255), "Unknown ChunkType: 255"},
	}

	for _, tc := range tt {
		if tc.chunkType.String() != tc.expected {
			t.Errorf("failed to stringify chunkType %v, expected %s", tc.chunkType, tc.expected)
		}
	}
}