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

Function TestBuffer_float64

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

Source from the content-addressed store, hash-verified

448}
449
450func TestBuffer_float64(t *testing.T) {
451 got := float64(0)
452 for i := 0; i < 500; i++ {
453 writer := NewBuffer()
454 want := rand.Float64()
455
456 err := writer.WriteFloat64(want, 3)
457 if err != nil {
458 t.Errorf("Test Write_float64 failed. err:%s\n", err)
459 }
460
461 reader := r(writer)
462 err = reader.ReadFloat64(&got, 3, true)
463 if err != nil {
464 t.Errorf("Test Read_float64 failed. err:%s\n", err)
465 }
466
467 if want != got {
468 t.Errorf("Test Write_float64 failed. want:%v, got:%v\n", want, got)
469 }
470 }
471}
472
473func TestBuffer_getTypeStr(t *testing.T) {
474 wants := []string{

Callers

nothing calls this directly

Calls 5

WriteFloat64Method · 0.95
NewBufferFunction · 0.85
rFunction · 0.85
ReadFloat64Method · 0.80
ErrorfMethod · 0.45

Tested by

no test coverage detected