Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

test: add tests for rabin chunking #74

Merged
merged 1 commit into from
Jul 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions test/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,46 @@ describe('files', function () {
)
})

it('rabin chunker', () => {
const chunkSize = 262144
const buffer = Buffer.alloc(chunkSize, 0)
const data = bufferStream(chunkSize, {
generator: (size, callback) => {
callback(null, buffer.slice(0, size))
}
})
const options = {
chunker: 'rabin-512-1024-2048',
pin: false,
preload: false
}

return compare(
testHashesAreEqual(go, data, options),
testHashesAreEqual(js, data, options)
)
})

it('rabin chunker small chunks', () => {
const chunkSize = 262144
const buffer = Buffer.alloc(chunkSize, 0)
const data = bufferStream(chunkSize, {
generator: (size, callback) => {
callback(null, buffer.slice(0, size))
}
})
const options = {
chunker: 'rabin-16-16-16',
pin: false,
preload: false
}

return compare(
testHashesAreEqual(go, data, options),
testHashesAreEqual(js, data, options)
)
})

it('hamt shards', () => {
const data = crypto.randomBytes(100)
const files = []
Expand Down