Skip to content

Commit

Permalink
test: add tests for Binary Equivalent Algorithm (TheAlgorithms#1560)
Browse files Browse the repository at this point in the history
* test: add tests for Binary Equivalent Algorithm

* test: Refactored tests using .each()

* Update BinaryEquivalent.test.js

---------

Co-authored-by: {Harshit Malpotra} <{[email protected]}>
Co-authored-by: Lars Müller <[email protected]>
  • Loading branch information
3 people authored Oct 22, 2023
1 parent 0315c8a commit 60443c7
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Recursive/test/BinaryEquivalent.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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);
}
)
})

0 comments on commit 60443c7

Please sign in to comment.