Skip to content

Commit e33503f

Browse files
authored
merge: Add test case to DecimalToBinary,DecimalToOctal & OctToDecimal (#932)
1 parent 92a2f6d commit e33503f

File tree

3 files changed

+78
-0
lines changed

3 files changed

+78
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { decimalToBinary } from '../DecimalToBinary'
2+
3+
test('The Binary representation of 35 is 100011', () => {
4+
const res = decimalToBinary(35)
5+
expect(res).toBe('100011')
6+
})
7+
8+
test('The Binary representation of 1 is 1', () => {
9+
const res = decimalToBinary(1)
10+
expect(res).toBe('1')
11+
})
12+
13+
test('The Binary representation of 1000 is 1111101000', () => {
14+
const res = decimalToBinary(1000)
15+
expect(res).toBe('1111101000')
16+
})
17+
18+
test('The Binary representation of 2 is 10', () => {
19+
const res = decimalToBinary(2)
20+
expect(res).toBe('10')
21+
})
22+
23+
test('The Binary representation of 17 is 10001', () => {
24+
const res = decimalToBinary(17)
25+
expect(res).toBe('10001')
26+
})
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { decimalToOctal } from '../DecimalToOctal'
2+
3+
test('The Octal representation of 8 is 10', () => {
4+
const res = decimalToOctal(8)
5+
expect(res).toBe(10)
6+
})
7+
8+
test('The Octal representation of 1 is 1', () => {
9+
const res = decimalToOctal(1)
10+
expect(res).toBe(1)
11+
})
12+
13+
test('The Octal representation of 0 is 0', () => {
14+
const res = decimalToOctal(0)
15+
expect(res).toBe(0)
16+
})
17+
18+
test('The Octal representation of 100 is 144', () => {
19+
const res = decimalToOctal(100)
20+
expect(res).toBe(144)
21+
})
22+
23+
test('The Octal representation of 111 is 157', () => {
24+
const res = decimalToOctal(111)
25+
expect(res).toBe(157)
26+
})

Conversions/test/OctToDecimal.test.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { octalToDecimal } from '../OctToDecimal'
2+
3+
test('The Decimal representation of Octal number 56 is 46', () => {
4+
const res = octalToDecimal(56)
5+
expect(res).toBe(46)
6+
})
7+
8+
test('The Decimal representation of Octal number 99 is 81', () => {
9+
const res = octalToDecimal(99)
10+
expect(res).toBe(81)
11+
})
12+
13+
test('The Decimal representation of Octal number 17 is 15', () => {
14+
const res = octalToDecimal(17)
15+
expect(res).toBe(15)
16+
})
17+
18+
test('The Decimal representation of Octal number 100 is 64', () => {
19+
const res = octalToDecimal(100)
20+
expect(res).toBe(64)
21+
})
22+
23+
test('The Decimal representation of Octal number 0 is 0', () => {
24+
const res = octalToDecimal(0)
25+
expect(res).toBe(0)
26+
})

0 commit comments

Comments
 (0)