MCPcopy Index your code
hub / github.com/tinylib/msgp / TestTime

Function TestTime

msgp/read_test.go:916–940  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

914}
915
916func TestTime(t *testing.T) {
917 var buf bytes.Buffer
918 now := time.Now()
919 en := NewWriter(&buf)
920 dc := NewReader(&buf)
921
922 err := en.WriteTime(now)
923 if err != nil {
924 t.Fatal(err)
925 }
926 err = en.Flush()
927 if err != nil {
928 t.Fatal(err)
929 }
930
931 out, err := dc.ReadTime()
932 if err != nil {
933 t.Fatal(err)
934 }
935
936 // check for equivalence
937 if !now.Equal(out) {
938 t.Fatalf("%s in; %s out", now, out)
939 }
940}
941
942func BenchmarkReadTime(b *testing.B) {
943 t := time.Now()

Callers

nothing calls this directly

Calls 6

WriteTimeMethod · 0.95
FlushMethod · 0.95
ReadTimeMethod · 0.95
NewWriterFunction · 0.85
NewReaderFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…