mirror of
https://github.com/Cameri/nostream.git
synced 2025-03-27 02:02:58 +01:00
11 lines
435 B
TypeScript
11 lines
435 B
TypeScript
import { expect } from 'chai'
|
|
import { getLeadingZeroBits } from '../../../src/utils/proof-of-work'
|
|
|
|
describe('getLeadingZeroBits()', () => {
|
|
['80', '40', '20', '10', '08', '04', '02', '01', '0080', '0040', '0020', '0010', '0008', '0004', '0002', '0001', '0000'].forEach((input, index) => {
|
|
it(`returns ${index} given ${input}`, () => {
|
|
expect(getLeadingZeroBits(Buffer.from(input, 'hex'))).to.equal(index)
|
|
})
|
|
})
|
|
})
|