MCPcopy Create free account
hub / github.com/Edgio/vflow / TestDecodeIEEE802

Function TestDecodeIEEE802

packet/ethernet_test.go:27–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25import "testing"
26
27func TestDecodeIEEE802(t *testing.T) {
28 b := []byte{
29 0xd4, 0x4, 0xff, 0x1,
30 0x1d, 0x9e, 0x30, 0x7c,
31 0x5e, 0xe5, 0x59, 0xef,
32 0x8, 0x0, 0x45, 0x0, 0x0,
33 }
34
35 d, err := decodeIEEE802(b)
36 if err != nil {
37 t.Error("unexpected error", err)
38 }
39
40 if d.DstMAC != "d4:04:ff:01:1d:9e" {
41 t.Error("expected d4:04:ff:01:1d:9e, got", d.SrcMAC)
42 }
43
44 if d.SrcMAC != "30:7c:5e:e5:59:ef" {
45 t.Error("expected 30:7c:5e:e5:59:ef, got", d.DstMAC)
46 }
47
48 if d.Vlan != 0 {
49 t.Error("expected 0, got", d.Vlan)
50 }
51
52 if d.EtherType != 0x800 {
53 t.Error("expected 0x800, got", d.EtherType)
54 }
55}

Callers

nothing calls this directly

Calls 1

decodeIEEE802Function · 0.85

Tested by

no test coverage detected