mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2026-03-13 15:21:15 +08:00
merge: Add test case to DecimalToBinary,DecimalToOctal & OctToDecimal (#932)
This commit is contained in:
26
Conversions/test/DecimalToBinary.test.js
Normal file
26
Conversions/test/DecimalToBinary.test.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import { decimalToBinary } from '../DecimalToBinary'
|
||||
|
||||
test('The Binary representation of 35 is 100011', () => {
|
||||
const res = decimalToBinary(35)
|
||||
expect(res).toBe('100011')
|
||||
})
|
||||
|
||||
test('The Binary representation of 1 is 1', () => {
|
||||
const res = decimalToBinary(1)
|
||||
expect(res).toBe('1')
|
||||
})
|
||||
|
||||
test('The Binary representation of 1000 is 1111101000', () => {
|
||||
const res = decimalToBinary(1000)
|
||||
expect(res).toBe('1111101000')
|
||||
})
|
||||
|
||||
test('The Binary representation of 2 is 10', () => {
|
||||
const res = decimalToBinary(2)
|
||||
expect(res).toBe('10')
|
||||
})
|
||||
|
||||
test('The Binary representation of 17 is 10001', () => {
|
||||
const res = decimalToBinary(17)
|
||||
expect(res).toBe('10001')
|
||||
})
|
||||
Reference in New Issue
Block a user