mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-12-19 06:58:15 +08:00
algorithm: signum (#1266)
This commit is contained in:
committed by
GitHub
parent
f954fb1ff7
commit
65cceae0be
19
Maths/test/Signum.test.js
Normal file
19
Maths/test/Signum.test.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { signum } from '../Signum'
|
||||
|
||||
describe('The sign of a number', () => {
|
||||
it('Sign of 10', () => {
|
||||
expect(signum(10)).toBe(1)
|
||||
})
|
||||
|
||||
it('Sign of 0', () => {
|
||||
expect(signum(0)).toBe(0)
|
||||
})
|
||||
|
||||
it('Sign of -420', () => {
|
||||
expect(signum(-420)).toBe(-1)
|
||||
})
|
||||
|
||||
it('Sign of NaN', () => {
|
||||
expect(signum(NaN)).toBe(NaN)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user