prysm-pulse/beacon-chain/p2p/encoder/snappy_test.go
Raul Jordan a9a4bb9163
Move Shared/Testutil into Testing (#9659)
* move testutil

* util pkg

* build

* gaz

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2021-09-23 18:53:46 +00:00

37 lines
867 B
Go

package encoder
import (
"bytes"
"reflect"
"testing"
"github.com/golang/snappy"
"github.com/prysmaticlabs/prysm/testing/assert"
)
func TestSszNetworkEncoder_BufferedReader(t *testing.T) {
r := make([]byte, 10)
bufR := snappy.NewReader(bytes.NewBuffer(r))
ptr := reflect.ValueOf(bufR).Pointer()
bufReaderPool.Put(bufR)
r2 := make([]byte, 10)
rdr := newBufferedReader(bytes.NewBuffer(r2))
nPtr := reflect.ValueOf(rdr).Pointer()
assert.Equal(t, ptr, nPtr, "invalid pointer value")
}
func TestSszNetworkEncoder_BufferedWriter(t *testing.T) {
r := make([]byte, 10)
bufR := snappy.NewBufferedWriter(bytes.NewBuffer(r))
ptr := reflect.ValueOf(bufR).Pointer()
bufWriterPool.Put(bufR)
r2 := make([]byte, 10)
rdr := newBufferedWriter(bytes.NewBuffer(r2))
nPtr := reflect.ValueOf(rdr).Pointer()
assert.Equal(t, ptr, nPtr, "invalid pointer value")
}