mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2026-03-13 15:21:15 +08:00
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:
25
Maths/test/IsOdd.test.js
Normal file
25
Maths/test/IsOdd.test.js
Normal 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)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user