mirror of
https://github.com/Cameri/nostream.git
synced 2025-06-01 10:39:22 +02:00
test: proof of work utils
This commit is contained in:
parent
ac5a9d6788
commit
dca599da26
10
test/unit/utils/proof-of-work.spec.ts
Normal file
10
test/unit/utils/proof-of-work.spec.ts
Normal file
@ -0,0 +1,10 @@
|
||||
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)
|
||||
})
|
||||
})
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user