merge: Improved IsOdd function (#914)

* refactor: used Boolean function for conversion

* feat: added one more function and test cases

* test: refactor test case & fixed var names

* chore: fixed test placeholder
This commit is contained in:
Fahim Faisaal
2022-03-04 17:04:33 +06:00
committed by GitHub
parent cc55dabb4b
commit 98c46b4d9e
2 changed files with 66 additions and 5 deletions

25
Maths/test/IsOdd.test.js Normal file
View File

@@ -0,0 +1,25 @@
import { isOdd, isOddBitwise } from '../IsOdd'
describe('Testing the isOdd function', () => {
it('should return true, if the number is odd', () => {
const isOddNumber = isOdd(4)
expect(isOddNumber).toBe(false)
})
it('should return true, if the number is odd', () => {
const isOddNumber = isOdd(7)
expect(isOddNumber).toBe(true)
})
})
describe('Testing the isOddBitwise function', () => {
it('should return true, if the number is odd', () => {
const isOddNumber = isOddBitwise(6)
expect(isOddNumber).toBe(false)
})
it('should return true, if the number is odd', () => {
const isOddNumber = isOddBitwise(3)
expect(isOddNumber).toBe(true)
})
})