MCPcopy Index your code
hub / github.com/google/gopacket / TestNgWriteComplex

Function TestNgWriteComplex

pcapgo/ngwrite_test.go:65–215  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

63}
64
65func TestNgWriteComplex(t *testing.T) {
66 test := ngFileReadTest{
67 linkType: layers.LinkTypeEthernet,
68 sections: []ngFileReadTestSection{
69 {
70 sectionInfo: NgSectionInfo{
71 Comment: "A test",
72 },
73 ifaces: []NgInterface{
74 {
75 Name: "in0",
76 Comment: "test0",
77 Description: "some test interface",
78 LinkType: layers.LinkTypeEthernet,
79 TimestampResolution: 3,
80 Statistics: NgInterfaceStatistics{
81 LastUpdate: time.Unix(1519128000, 195312500).UTC(),
82 StartTime: time.Unix(1519128000-100, 195312500).UTC(),
83 EndTime: time.Unix(1519128000, 195312500).UTC(),
84 PacketsReceived: 100,
85 PacketsDropped: 1,
86 },
87 },
88 {
89 Name: "null0",
90 Description: "some test interface",
91 Filter: "none",
92 OS: "not needed",
93 LinkType: layers.LinkTypeEthernet,
94 TimestampOffset: 100,
95 Statistics: NgInterfaceStatistics{
96 LastUpdate: time.Unix(1519128000, 195312500).UTC(),
97 },
98 },
99 },
100 },
101 },
102 packets: []ngFileReadTestPacket{
103 {
104 data: ngPacketSource[0],
105 ci: gopacket.CaptureInfo{
106 Timestamp: time.Unix(1519128000-900, 195312500).UTC(),
107 Length: len(ngPacketSource[0]),
108 CaptureLength: len(ngPacketSource[0]),
109 InterfaceIndex: 0,
110 },
111 },
112 {
113 data: ngPacketSource[4],
114 ci: gopacket.CaptureInfo{
115 Timestamp: time.Unix(1519128000-800, 195312500).UTC(),
116 Length: len(ngPacketSource[4]),
117 CaptureLength: len(ngPacketSource[4]),
118 InterfaceIndex: 1,
119 },
120 },
121 {
122 data: ngPacketSource[1],

Callers

nothing calls this directly

Calls 8

NewNgWriterInterfaceFunction · 0.85
ngRunFileReadTestFunction · 0.85
AddInterfaceMethod · 0.80
WriteInterfaceStatsMethod · 0.80
FlushMethod · 0.80
BytesMethod · 0.65
WritePacketMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…