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

Function TestAppendFloat32

msgp/write_bytes_test.go:231–243  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

229}
230
231func TestAppendFloat32(t *testing.T) {
232 f := float32(3.14159)
233 var buf bytes.Buffer
234 en := NewWriter(&buf)
235
236 var bts []byte
237 en.WriteFloat32(f)
238 en.Flush()
239 bts = AppendFloat32(bts[0:0], f)
240 if !bytes.Equal(buf.Bytes(), bts) {
241 t.Errorf("for float %f, encoder wrote %q; append wrote %q", f, buf.Bytes(), bts)
242 }
243}
244
245func BenchmarkAppendFloat32(b *testing.B) {
246 f := float32(3.14159)

Callers

nothing calls this directly

Calls 5

WriteFloat32Method · 0.95
FlushMethod · 0.95
NewWriterFunction · 0.85
AppendFloat32Function · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…