mirror of
https://github.com/josdejong/mathjs.git
synced 2025-12-08 19:46:04 +00:00
31 lines
1.2 KiB
JavaScript
31 lines
1.2 KiB
JavaScript
// test setIsSubset
|
|
import assert from 'assert'
|
|
|
|
import math from '../../../../src/bundleAny'
|
|
|
|
describe('setIsSubset', function () {
|
|
it('should return true or false', function () {
|
|
assert.strictEqual(math.setIsSubset([1, 2], [1, 2, 3, 4]), true)
|
|
assert.strictEqual(math.setIsSubset([1, 2, 3, 4], [1, 2]), false)
|
|
assert.strictEqual(math.setIsSubset([], [1, 2]), true)
|
|
assert.strictEqual(math.setIsSubset([], []), true)
|
|
|
|
assert.strictEqual(math.setIsSubset([1, math.complex(2, 2)], [1, 3, 4, math.complex(2, 2)]), true)
|
|
})
|
|
|
|
it('should return true or false', function () {
|
|
assert.strictEqual(math.setIsSubset([1, 1, 2, 3, 4, 4], [1, 2, 3, 4, 4, 4]), false)
|
|
assert.strictEqual(math.setIsSubset([1, 2, 3, 4, 4], [1, 2, 3, 4, 4, 4]), true)
|
|
assert.strictEqual(math.setIsSubset([1, 2, 4, 3, 4], [1, 2, 4, 3, 4, 4]), true)
|
|
})
|
|
|
|
it('should return boolean', function () {
|
|
assert.strictEqual(math.typeOf(math.setIsSubset([1, 2, 3], [3, 4, 5])), 'boolean')
|
|
})
|
|
|
|
it('should throw an error in case of invalid number of arguments', function () {
|
|
assert.throws(function () { math.setIsSubset() }, /TypeError: Too few arguments/)
|
|
assert.throws(function () { math.setIsSubset([], [], []) }, /TypeError: Too many arguments/)
|
|
})
|
|
})
|