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

Function TestReadFloat64Bytes

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

Source from the content-addressed store, hash-verified

168}
169
170func TestReadFloat64Bytes(t *testing.T) {
171 var buf bytes.Buffer
172 en := NewWriter(&buf)
173 en.WriteFloat64(3.14159)
174 en.Flush()
175
176 out, left, err := ReadFloat64Bytes(buf.Bytes())
177 if err != nil {
178 t.Fatal(err)
179 }
180 if len(left) != 0 {
181 t.Errorf("expected 0 bytes left; found %d", len(left))
182 }
183 if out != 3.14159 {
184 t.Errorf("%f in; %f out", 3.14159, out)
185 }
186}
187
188func BenchmarkReadFloat64Bytes(b *testing.B) {
189 f := float64(3.14159)

Callers

nothing calls this directly

Calls 4

WriteFloat64Method · 0.95
FlushMethod · 0.95
NewWriterFunction · 0.85
ReadFloat64BytesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…