Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
jianoaix committed Jun 18, 2024
1 parent 4701c12 commit eb3f8c9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions node/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,25 @@ func CreateBatch(t *testing.T) (*core.BatchHeader, []*core.BlobMessage, []*pb.Bl
return &batchHeader, blobMessage, blobs
}

func TestEncodeDecodeChunks(t *testing.T) {
numSamples := 32
numChunks := 10
chunkSize := 2 * 1024
for n := 0; n < numSamples; n++ {
chunks := make([][]byte, numChunks)
for i := 0; i < numChunks; i++ {
chunk := make([]byte, chunkSize)
_, _ = cryptorand.Read(chunk)
chunks[i] = chunk
}
encoded, _ := node.EncodeChunks(chunks)
decoded, _ := node.DecodeChunks(encoded)
for i := 0; i < numChunks; i++ {
assert.True(t, bytes.Equal(decoded[i], chunks[i]))
}
}
}

func TestStoringBlob(t *testing.T) {
staleMeasure := uint32(1)
storeDuration := uint32(1)
Expand Down

0 comments on commit eb3f8c9

Please sign in to comment.