2022-02-22 12:29:26 +01:00
|
|
|
'use strict'
|
|
|
|
|
|
2021-12-23 10:31:29 +01:00
|
|
|
const assert = require('assert')
|
2019-03-28 02:16:28 -07:00
|
|
|
|
2021-12-23 10:31:29 +01:00
|
|
|
const { HEADER_COOKIE, HEADER_VERSION, SECTOR_SIZE } = require('./_constants')
|
2019-03-28 02:16:28 -07:00
|
|
|
|
2021-12-23 10:31:29 +01:00
|
|
|
module.exports = (header, footer) => {
|
2019-03-28 02:16:28 -07:00
|
|
|
assert.strictEqual(header.cookie, HEADER_COOKIE)
|
|
|
|
|
assert.strictEqual(header.dataOffset, undefined)
|
|
|
|
|
assert.strictEqual(header.headerVersion, HEADER_VERSION)
|
|
|
|
|
assert(Number.isInteger(Math.log2(header.blockSize / SECTOR_SIZE)))
|
|
|
|
|
|
|
|
|
|
if (footer !== undefined) {
|
|
|
|
|
assert(header.maxTableEntries >= footer.currentSize / header.blockSize)
|
|
|
|
|
}
|
|
|
|
|
}
|