(t *testing.T)
| 262 | } |
| 263 | |
| 264 | func TestWriteFloat32(t *testing.T) { |
| 265 | var buf bytes.Buffer |
| 266 | wr := NewWriter(&buf) |
| 267 | |
| 268 | for range 10000 { |
| 269 | buf.Reset() |
| 270 | flt := (rand.Float32() - 0.5) * math.MaxFloat32 |
| 271 | err := wr.WriteFloat32(flt) |
| 272 | if err != nil { |
| 273 | t.Errorf("Error with %f: %s", flt, err) |
| 274 | } |
| 275 | err = wr.Flush() |
| 276 | if err != nil { |
| 277 | t.Fatal(err) |
| 278 | } |
| 279 | |
| 280 | bts := buf.Bytes() |
| 281 | |
| 282 | if bts[0] != mfloat32 { |
| 283 | t.Errorf("Leading byte was %x and not %x", bts[0], mfloat64) |
| 284 | } |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | func BenchmarkWriteFloat32(b *testing.B) { |
| 289 | f := rand.Float32() |
nothing calls this directly
no test coverage detected
searching dependent graphs…