MCPcopy
hub / github.com/tinylib/msgp / TestWriteInt64

Function TestWriteInt64

msgp/write_test.go:299–321  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

297}
298
299func TestWriteInt64(t *testing.T) {
300 var buf bytes.Buffer
301 wr := NewWriter(&buf)
302
303 for range 10000 {
304 buf.Reset()
305
306 num := (rand.Int63n(math.MaxInt64)) - (math.MaxInt64 / 2)
307
308 err := wr.WriteInt64(num)
309 if err != nil {
310 t.Fatal(err)
311 }
312 err = wr.Flush()
313 if err != nil {
314 t.Fatal(err)
315 }
316
317 if buf.Len() > 9 {
318 t.Errorf("buffer length should be <= 9; it's %d", buf.Len())
319 }
320 }
321}
322
323func BenchmarkWriteInt64(b *testing.B) {
324 wr := NewWriter(Nowhere)

Callers

nothing calls this directly

Calls 5

WriteInt64Method · 0.95
FlushMethod · 0.95
NewWriterFunction · 0.85
LenMethod · 0.65
ResetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…