MCPcopy
hub / github.com/TarsCloud/TarsGo / TestBuffer_float32

Function TestBuffer_float32

tars/protocol/codec/codec_test.go:427–448  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

425}
426
427func TestBuffer_float32(t *testing.T) {
428 got := float32(0)
429 for i := 0; i < 500; i++ {
430 writer := NewBuffer()
431 want := rand.Float32()
432
433 err := writer.WriteFloat32(want, 3)
434 if err != nil {
435 t.Errorf("Test Write_float32 failed. err:%s\n", err)
436 }
437
438 reader := r(writer)
439 err = reader.ReadFloat32(&got, 3, true)
440 if err != nil {
441 t.Errorf("Test Read_float32 failed. err:%s\n", err)
442 }
443
444 if want != got {
445 t.Errorf("Test Write_float32 failed. want:%v, got:%v\n", want, got)
446 }
447 }
448}
449
450func TestBuffer_float64(t *testing.T) {
451 got := float64(0)

Callers

nothing calls this directly

Calls 5

WriteFloat32Method · 0.95
NewBufferFunction · 0.85
rFunction · 0.85
ReadFloat32Method · 0.80
ErrorfMethod · 0.45

Tested by

no test coverage detected