MCPcopy Create free account
hub / github.com/ethstorage/es-node / TestEncodeDecodeBlob

Function TestEncodeDecodeBlob

cmd/es-utils/utils/utils_test.go:12–29  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestEncodeDecodeBlob(t *testing.T) {
13 type gen func(*testing.T, int) []byte
14 tests := []gen{
15 generateSequentialBytes,
16 readTxt,
17 }
18 for _, tt := range tests {
19 data := tt(t, 10*32)
20 t.Run("", func(t *testing.T) {
21 encoded := EncodeBlobs(data)
22 decoded := DecodeBlob(encoded[0][:])
23 decoded = decoded[:len(data)]
24 if !bytes.Equal(data, decoded) {
25 t.Errorf("data:\n%v\nencoded/decoded:\n%v\n", data, decoded)
26 }
27 })
28 }
29}
30
31func generateSequentialBytes(t *testing.T, n int) []byte {
32 data := make([]byte, n)

Callers

nothing calls this directly

Calls 2

EncodeBlobsFunction · 0.85
DecodeBlobFunction · 0.85

Tested by

no test coverage detected