MCPcopy
hub / github.com/google/gopacket / TestASFSerializeTo

Function TestASFSerializeTo

layers/asf_test.go:54–85  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

52}
53
54func TestASFSerializeTo(t *testing.T) {
55 table := []struct {
56 layer *ASF
57 want []byte
58 }{
59 {
60 &ASF{
61 ASFDataIdentifier: ASFDataIdentifierPresencePing,
62 },
63 []byte{0, 0, 0x11, 0xbe, 0x80, 0, 0, 0},
64 },
65 {
66 &ASF{
67 ASFDataIdentifier: ASFDataIdentifierPresencePong,
68 // ensures length is being overridden - should be encoded to 0
69 // as there is no payload
70 Length: 1,
71 },
72 []byte{0, 0, 0x11, 0xbe, 0x40, 0, 0, 0},
73 },
74 }
75 for _, test := range table {
76 b, err := serializeASF(test.layer)
77 switch {
78 case err != nil && test.want != nil:
79 t.Errorf("serialize %v failed with %v, wanted %v", test.layer,
80 err, test.want)
81 case err == nil && !bytes.Equal(b, test.want):
82 t.Errorf("serialize %v = %v, want %v", test.layer, b, test.want)
83 }
84 }
85}

Callers

nothing calls this directly

Calls 1

serializeASFFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…