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

Function TestWriteUint64

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

Source from the content-addressed store, hash-verified

331}
332
333func TestWriteUint64(t *testing.T) {
334 var buf bytes.Buffer
335 wr := NewWriter(&buf)
336
337 for range 10000 {
338 buf.Reset()
339
340 num := uint64(rand.Int63n(math.MaxInt64))
341
342 err := wr.WriteUint64(num)
343 if err != nil {
344 t.Fatal(err)
345 }
346 err = wr.Flush()
347 if err != nil {
348 t.Fatal(err)
349 }
350 if buf.Len() > 9 {
351 t.Errorf("buffer length should be <= 9; it's %d", buf.Len())
352 }
353 }
354}
355
356func BenchmarkWriteUint64(b *testing.B) {
357 wr := NewWriter(Nowhere)

Callers

nothing calls this directly

Calls 5

WriteUint64Method · 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…