1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-09 19:32:24 +08:00

move first data block into top level dag node

This commit is contained in:
Jeromy
2014-09-15 05:35:31 +00:00
parent 78454884db
commit fdcd015eed
5 changed files with 29 additions and 5 deletions

View File

@ -82,3 +82,19 @@ func arrComp(a, b []byte) error {
func TestMaybeRabinConsistency(t *testing.T) {
testFileConsistency(t, NewMaybeRabin(4096), 256*4096)
}
func TestRabinBlockSize(t *testing.T) {
buf := new(bytes.Buffer)
nbytes := 1024 * 1024
io.CopyN(buf, rand.Reader, int64(nbytes))
rab := NewMaybeRabin(4096)
blkch := rab.Split(buf)
var blocks [][]byte
for b := range blkch {
blocks = append(blocks, b)
}
fmt.Printf("Avg block size: %d\n", nbytes/len(blocks))
}