MCPcopy Create free account
hub / github.com/chain/Core / TestReadWriteVarint63

Function TestReadWriteVarint63

encoding/blockchain/blockchain_test.go:332–345  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

330}
331
332func TestReadWriteVarint63(t *testing.T) {
333 f := func(x uint64) bool {
334 var buf bytes.Buffer
335 _, err := WriteVarint63(&buf, x)
336 if err == ErrRange {
337 return x > math.MaxInt64
338 }
339 v, err := ReadVarint63(NewReader(buf.Bytes()))
340 return v == x && err == nil
341 }
342 if err := quick.Check(f, nil); err != nil {
343 t.Error(err)
344 }
345}
346
347func TestReadWriteVarstr31(t *testing.T) {
348 f := func(x []byte) bool {

Callers

nothing calls this directly

Calls 6

WriteVarint63Function · 0.85
ReadVarint63Function · 0.85
NewReaderFunction · 0.85
CheckMethod · 0.80
BytesMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected