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

Function TestReadComplex128Bytes

msgp/read_bytes_test.go:576–598  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

574}
575
576func TestReadComplex128Bytes(t *testing.T) {
577 var buf bytes.Buffer
578 en := NewWriter(&buf)
579
580 tests := []complex128{complex(0, 0), complex(12.8, 32.0)}
581
582 for i, v := range tests {
583 buf.Reset()
584 en.WriteComplex128(v)
585 en.Flush()
586
587 out, left, err := ReadComplex128Bytes(buf.Bytes())
588 if err != nil {
589 t.Errorf("test case %d: %s", i, err)
590 }
591 if len(left) != 0 {
592 t.Errorf("expected 0 bytes left; found %d", len(left))
593 }
594 if out != v {
595 t.Errorf("%f in; %f out", v, out)
596 }
597 }
598}
599
600// both the 'str' and 'bin' types are acceptable map keys
601func TestReadMapKey(t *testing.T) {

Callers

nothing calls this directly

Calls 5

WriteComplex128Method · 0.95
FlushMethod · 0.95
NewWriterFunction · 0.85
ReadComplex128BytesFunction · 0.85
ResetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…