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

Function TestBuffer_bool

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

Source from the content-addressed store, hash-verified

404}
405
406func TestBuffer_bool(t *testing.T) {
407 var got bool
408 wants := []bool{true, false}
409 for _, want := range wants {
410 buf := NewBuffer()
411 err := buf.WriteBool(want, 10)
412 if err != nil {
413 t.Errorf("Test Write_bool failed. err:%s\n", err)
414 }
415
416 reader := r(buf)
417 err = reader.ReadBool(&got, 10, true)
418 if err != nil {
419 t.Errorf("Test Read_bool failed. err:%s\n", err)
420 }
421 if got != want {
422 t.Errorf("Test Write_bool failed, want:%v, got:%v\n", want, got)
423 }
424 }
425}
426
427func TestBuffer_float32(t *testing.T) {
428 got := float32(0)

Callers

nothing calls this directly

Calls 5

WriteBoolMethod · 0.95
NewBufferFunction · 0.85
rFunction · 0.85
ReadBoolMethod · 0.80
ErrorfMethod · 0.45

Tested by

no test coverage detected