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

Function TestReadTimeBytes

msgp/read_bytes_test.go:662–680  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

660}
661
662func TestReadTimeBytes(t *testing.T) {
663 var buf bytes.Buffer
664 en := NewWriter(&buf)
665
666 now := time.Now()
667 en.WriteTime(now)
668 en.Flush()
669 out, left, err := ReadTimeBytes(buf.Bytes())
670 if err != nil {
671 t.Fatal(err)
672 }
673
674 if len(left) != 0 {
675 t.Errorf("expected 0 bytes left; found %d", len(left))
676 }
677 if !now.Equal(out) {
678 t.Errorf("%s in; %s out", now, out)
679 }
680}
681
682func BenchmarkReadTimeBytes(b *testing.B) {
683 data := AppendTime(nil, time.Now())

Callers

nothing calls this directly

Calls 5

WriteTimeMethod · 0.95
FlushMethod · 0.95
NewWriterFunction · 0.85
ReadTimeBytesFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…