feat: add built-in typeOf operator to PocomathInstance
This commit is contained in:
parent
7bbdc049ce
commit
1076c3c727
2 changed files with 21 additions and 1 deletions
|
@ -10,6 +10,15 @@ describe('The default full pocomath instance "math"', () => {
|
|||
assert.strictEqual(undef.length, 0)
|
||||
})
|
||||
|
||||
it('has a built-in typeOf operator', () => {
|
||||
assert.strictEqual(math.typeOf(42), 'NumInt')
|
||||
assert.strictEqual(math.typeOf(-1.5), 'number')
|
||||
assert.strictEqual(math.typeOf(-42n), 'bigint')
|
||||
assert.strictEqual(math.typeOf(undefined), 'undefined')
|
||||
assert.strictEqual(math.typeOf({re: 15n, im: -2n}), 'GaussianInteger')
|
||||
assert.strictEqual(math.typeOf({re: 6.28, im: 2.72}), 'Complex')
|
||||
})
|
||||
|
||||
it('can subtract numbers', () => {
|
||||
assert.strictEqual(math.subtract(12, 5), 7)
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue