mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 00:01:37 +08:00

* 📦 NEW: Added solution for ProjectEuler-007 * 🐛 FIX: Spelling mistake fixes * 👌 IMPROVE: changed variable name from `inc` to `candidateValue` and thrown error in case of invalid input * 👌 IMPROVE: Modified the code * 👌 IMPROVE: Added test case for ProjectEuler Problem001 * 👌 IMPROVE: Added test cases for Project Euler Problem 4 * 👌 IMPROVE: auto prettier fixes --------- Co-authored-by: Omkarnath Parida <omkarnath.parida@yocket.in>
30 lines
511 B
JavaScript
30 lines
511 B
JavaScript
import { binaryEquivalent } from '../BinaryEquivalent'
|
|
|
|
const tests = [
|
|
{
|
|
test: 2,
|
|
expectedValue: '10'
|
|
},
|
|
{
|
|
test: 0,
|
|
expectedValue: '0'
|
|
},
|
|
{
|
|
test: 543,
|
|
expectedValue: '1000011111'
|
|
},
|
|
{
|
|
test: 4697621023,
|
|
expectedValue: '100011000000000000000001000011111'
|
|
}
|
|
]
|
|
|
|
describe('Binary Equivalent', () => {
|
|
test.each(tests)(
|
|
'of $test should be $expectedValue',
|
|
({ test, expectedValue }) => {
|
|
expect(binaryEquivalent(test)).toBe(expectedValue)
|
|
}
|
|
)
|
|
})
|