Files
JavaScript/Bit-Manipulation/test/NextPowerOfTwo.test.js
2021-10-11 20:24:38 +03:00

19 lines
433 B
JavaScript

import { nextPowerOfTwo } from '../NextPowerOfTwo'
describe('NextPowerOfTwo', () => {
it.each`
input | result
${0} | ${1}
${1} | ${1}
${2} | ${2}
${3} | ${4}
${5} | ${8}
${125} | ${128}
${1024} | ${1024}
${10000} | ${16384}
`('returns $result when is given $input', ({ input, result }) => {
const res = nextPowerOfTwo(input)
expect(res).toBe(result)
})
})