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

Function TestWriteHeaderNanos

pcapgo/write_test.go:17–29  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15)
16
17func TestWriteHeaderNanos(t *testing.T) {
18 var buf bytes.Buffer
19 w := NewWriterNanos(&buf)
20 w.WriteFileHeader(0x1234, 0x56)
21 want := []byte{
22 0x4d, 0x3c, 0xb2, 0xa1, 0x02, 0x00, 0x04, 0x00,
23 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
24 0x34, 0x12, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00,
25 }
26 if got := buf.Bytes(); !bytes.Equal(got, want) {
27 t.Errorf("buf mismatch:\nwant: %+v\ngot: %+v", want, got)
28 }
29}
30
31func TestWriteHeader(t *testing.T) {
32 var buf bytes.Buffer

Callers

nothing calls this directly

Calls 3

NewWriterNanosFunction · 0.85
WriteFileHeaderMethod · 0.80
BytesMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…