From 8a12c8e9bcb97bf4c01345cd4d24fa773a855dbe Mon Sep 17 00:00:00 2001 From: jos Date: Sun, 3 Aug 2014 21:42:12 +0200 Subject: [PATCH] Fixed #200: A new instanceof of math.js must now be created as `math.create([options])` instead of `math([options])` --- HISTORY.md | 3 +++ docs/configuration.md | 10 +++---- examples/bignumbers.js | 6 +++-- lib/expression/node/ConditionalNode.js | 1 + lib/math.js | 26 ++++++++++++++----- test/contstants.test.js | 4 +-- test/deprecated.test.js | 10 +++---- test/expression/Parser.test.js | 2 +- test/expression/node/ArrayNode.test.js | 2 +- test/expression/node/AssignmentNode.test.js | 2 +- test/expression/node/BlockNode.test.js | 2 +- test/expression/node/ConditionalNode.test.js | 2 +- test/expression/node/ConstantNode.test.js | 4 +-- .../node/FunctionAssignmentNode.test.js | 2 +- test/expression/node/FunctionNode.test.js | 2 +- test/expression/node/IndexNode.test.js | 2 +- test/expression/node/Node.test.js | 2 +- test/expression/node/OperatorNode.test.js | 2 +- test/expression/node/SymbolNode.test.js | 2 +- test/expression/node/UpdateNode.test.js | 2 +- test/expression/parse.test.js | 4 +-- test/function/arithmetic/abs.test.js | 2 +- test/function/arithmetic/add.test.js | 2 +- test/function/arithmetic/ceil.test.js | 2 +- test/function/arithmetic/cube.test.js | 2 +- test/function/arithmetic/divide.test.js | 2 +- test/function/arithmetic/dotDivide.test.js | 2 +- test/function/arithmetic/dotMultiply.test.js | 2 +- test/function/arithmetic/dotPow.test.js | 2 +- test/function/arithmetic/exp.test.js | 2 +- test/function/arithmetic/fix.test.js | 2 +- test/function/arithmetic/floor.test.js | 2 +- test/function/arithmetic/gcd.test.js | 2 +- test/function/arithmetic/lcm.test.js | 2 +- test/function/arithmetic/log.test.js | 6 ++--- test/function/arithmetic/log10.test.js | 6 ++--- test/function/arithmetic/mod.test.js | 2 +- test/function/arithmetic/multiply.test.js | 2 +- test/function/arithmetic/norm.test.js | 2 +- test/function/arithmetic/pow.test.js | 2 +- test/function/arithmetic/round.test.js | 2 +- test/function/arithmetic/sign.test.js | 2 +- test/function/arithmetic/sqrt.test.js | 2 +- test/function/arithmetic/square.test.js | 2 +- test/function/arithmetic/subtract.test.js | 2 +- test/function/arithmetic/unaryMinus.test.js | 4 +-- test/function/arithmetic/unaryPlus.test.js | 4 +-- test/function/arithmetic/xgcd.test.js | 6 ++--- test/function/complex/arg.test.js | 2 +- test/function/complex/conj.test.js | 2 +- test/function/complex/im.test.js | 2 +- test/function/complex/re.test.js | 2 +- test/function/construction/bignumber.test.js | 2 +- test/function/construction/boolean.test.js | 2 +- test/function/construction/complex.test.js | 2 +- test/function/construction/index.test.js | 2 +- test/function/construction/matrix.test.js | 2 +- test/function/construction/number.test.js | 2 +- test/function/construction/parser.test.js | 2 +- test/function/construction/select.test.js | 2 +- test/function/construction/string.test.js | 2 +- test/function/construction/unit.test.js | 2 +- test/function/expression/compile.test.js | 2 +- test/function/expression/eval.test.js | 2 +- test/function/expression/help.test.js | 2 +- test/function/expression/parse.test.js | 2 +- test/function/matrix/concat.test.js | 2 +- test/function/matrix/det.test.js | 2 +- test/function/matrix/diag.test.js | 2 +- test/function/matrix/eye.test.js | 2 +- test/function/matrix/inv.test.js | 2 +- test/function/matrix/ones.test.js | 2 +- test/function/matrix/range.test.js | 6 ++--- test/function/matrix/resize.test.js | 8 +++--- test/function/matrix/size.test.js | 2 +- test/function/matrix/squeeze.test.js | 2 +- test/function/matrix/subset.test.js | 2 +- test/function/matrix/transpose.test.js | 2 +- test/function/matrix/zeros.test.js | 2 +- .../function/probability/combinations.test.js | 2 +- .../function/probability/distribution.test.js | 2 +- test/function/probability/factorial.test.js | 2 +- .../function/probability/permutations.test.js | 2 +- test/function/probability/pickRandom.test.js | 2 +- test/function/probability/random.test.js | 2 +- test/function/probability/randomInt.test.js | 2 +- test/function/relational/compare.test.js | 2 +- test/function/relational/equal.test.js | 2 +- test/function/relational/larger.test.js | 2 +- test/function/relational/largerEq.test.js | 2 +- test/function/relational/smaller.test.js | 2 +- test/function/relational/smallerEq.test.js | 2 +- test/function/relational/unequal.test.js | 2 +- test/function/statistics/max.test.js | 2 +- test/function/statistics/mean.test.js | 2 +- test/function/statistics/median.test.js | 2 +- test/function/statistics/min.test.js | 2 +- test/function/statistics/prod.test.js | 2 +- test/function/statistics/std.test.js | 2 +- test/function/statistics/sum.test.js | 2 +- test/function/statistics/var.test.js | 2 +- test/function/trigonometry/acos.test.js | 2 +- test/function/trigonometry/asin.test.js | 2 +- test/function/trigonometry/atan.test.js | 2 +- test/function/trigonometry/atan2.test.js | 2 +- test/function/trigonometry/cos.test.js | 2 +- test/function/trigonometry/cosh.test.js | 2 +- test/function/trigonometry/cot.test.js | 2 +- test/function/trigonometry/coth.test.js | 2 +- test/function/trigonometry/csc.test.js | 2 +- test/function/trigonometry/csch.test.js | 2 +- test/function/trigonometry/sec.test.js | 2 +- test/function/trigonometry/sech.test.js | 2 +- test/function/trigonometry/sin.test.js | 2 +- test/function/trigonometry/sinh.test.js | 2 +- test/function/trigonometry/tan.test.js | 2 +- test/function/trigonometry/tanh.test.js | 2 +- test/function/units/to.test.js | 2 +- test/function/utils/clone.test.js | 2 +- test/function/utils/forEach.test.js | 2 +- test/function/utils/format.test.js | 2 +- test/function/utils/import.test.js | 2 +- test/function/utils/map.test.js | 2 +- test/function/utils/print.test.js | 2 +- test/function/utils/typeof.test.js | 2 +- test/math.test.js | 14 +++++----- test/type/Help.test.js | 2 +- test/type/Matrix.test.js | 2 +- test/type/Range.test.js | 2 +- 129 files changed, 182 insertions(+), 164 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index d68469598..d5fcee508 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -3,6 +3,9 @@ ## not yet released, version 0.25.1 +- A new instance of math.js can no longer be created like `math([options])`, + to prevent side effects from math being a function instead of an object. + Instead, use the function `math.create([options])` to create a new instance. - Implemented `BigNumber` support for all constants: `pi`, `tau`, `e`, `phi`, `E`, `LN2`, `LN10`, `LOG2E`, `LOG10E`, `PI`, `SQRT1_2`, and `SQRT2`. - Implemented `BigNumber` support for functions `gcd`, `xgcd`, and `lcm`. diff --git a/docs/configuration.md b/docs/configuration.md index 49f044228..59794cdf7 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -5,8 +5,8 @@ configure math.js: - Configure an existing instance of math.js using `math.config(options)`, for example `math.config({number: 'bignumber'})` to change to BigNumbers. -- Create and configure a new instance of math.js using `math([options])`, - for example `var bigmath = math({number: 'bignumber'})` to create a new +- Create and configure a new instance of math.js using `math.create([options])`, + for example `var bigmath = math.create({number: 'bignumber'})` to create a new instance configured to use BigNumbers. The following configuration options are available: @@ -51,7 +51,7 @@ math.range(0, 4); // Matrix [0, 1, 2, 3] // create a new instance configured to use Arrays -var math2 = math({ +var math2 = math.create({ matrix: 'array' // Choose 'matrix' (default) or 'array' }); @@ -68,7 +68,7 @@ math2.range(0, 4); // Matrix [0, 1, 2, 3] // create an instance of math.js with bignumber configuration -var bigmath = math({ +var bigmath = math.create({ number: 'bignumber', // Choose 'number' (default) or 'bignumber' precision: 32 // 64 by default, only applicable for BigNumbers }); @@ -102,7 +102,7 @@ bigmath.eval('1 / 3'); // BigNumber, 0.33333333333333333333333333333333 math.range(0, 4); // Array [0, 1, 2, 3] // create a new instance of math.js with bignumber configuration - var bigmath = math({ + var bigmath = math.create({ number: 'bignumber', // Choose 'number' (default) or 'bignumber' precision: 32 // 64 by default, only applicable for BigNumbers }); diff --git a/examples/bignumbers.js b/examples/bignumbers.js index 08c2fa3eb..06f69f42c 100644 --- a/examples/bignumbers.js +++ b/examples/bignumbers.js @@ -1,8 +1,10 @@ // BigNumbers // load math.js -// the default type of numbers is configured as BigNumbers -var math = require('../index')({ +var math = require('../index'); + +// configure the default type of numbers as BigNumbers +math.config({ number: 'bignumber', // Default type of number: 'number' (default) or 'bignumber' precision: 20 // Number of significant digits for BigNumbers }); diff --git a/lib/expression/node/ConditionalNode.js b/lib/expression/node/ConditionalNode.js index 5ea699968..a7fd24f1e 100644 --- a/lib/expression/node/ConditionalNode.js +++ b/lib/expression/node/ConditionalNode.js @@ -4,6 +4,7 @@ var Node = require('./Node'); var latex = require('../../util/latex'); var BigNumber = require('decimal.js'); var Complex = require('../../type/Complex'); +var Unit = require('../../type/Unit'); var util = require('../../util'); var isString = util.string.isString; var isNumber = util.number.isNumber; diff --git a/lib/math.js b/lib/math.js index 22c98a011..58289ec97 100644 --- a/lib/math.js +++ b/lib/math.js @@ -15,17 +15,15 @@ var digits = require('./util/number').digits; * The number of significant digits for BigNumbers. * Not applicable for Numbers. */ -function factory (config) { +function create (config) { // simple test for ES5 support if (typeof Object.create !== 'function') { throw new Error('ES5 not supported by this JavaScript engine. ' + 'Please load the es5-shim and es5-sham library for compatibility.'); } - // create namespace (and factory for a new instance) - function math (config) { - return factory(config); - } + // create namespace + var math = {}; // create configuration options. These are private var _config = { @@ -100,6 +98,20 @@ function factory (config) { return object.clone(_config); }; + /** + * math.js factory function. Creates a new instance of math.js + * + * @param {Object} [config] Available configuration options: + * {String} matrix + * A string 'matrix' (default) or 'array'. + * {String} number + * A string 'number' (default) or 'bignumber' + * {Number} precision + * The number of significant digits for BigNumbers. + * Not applicable for Numbers. + */ + math.create = create; + // create a new BigNumber factory for this instance of math.js var BigNumber = require('decimal.js').constructor(); @@ -318,12 +330,12 @@ function factory (config) { } // create a default instance of math.js -var math = factory(); +var math = create(); if (typeof window !== 'undefined') { window.mathjs = math; // TODO: deprecate the mathjs namespace some day (replaced with 'math' since version 0.25.0) } // export the default instance -module.exports = factory(); +module.exports = math; diff --git a/test/contstants.test.js b/test/contstants.test.js index 14ea1035d..ddd51737c 100644 --- a/test/contstants.test.js +++ b/test/contstants.test.js @@ -1,5 +1,5 @@ var assert = require('assert'), - math = require('../index')(), + math = require('../index'), approx = require('../tools/approx'); describe('constants', function() { @@ -57,7 +57,7 @@ describe('constants', function() { }); describe('bignumber', function () { - var bigmath = math({number: 'bignumber', precision: 64}); + var bigmath = math.create({number: 'bignumber', precision: 64}); it('should have bignumber pi', function() { assert.equal(bigmath.pi.toString(), '3.141592653589793238462643383279502884197169399375105820974944592'); diff --git a/test/deprecated.test.js b/test/deprecated.test.js index e3de8f216..75cc57ea3 100644 --- a/test/deprecated.test.js +++ b/test/deprecated.test.js @@ -7,7 +7,7 @@ describe('deprecated stuff', function() { it ('should throw an error when using deprecated setting number.defaultType', function () { assert.throws(function () { - math({ + math.create({ number: { defaultType: 'number' } @@ -17,7 +17,7 @@ describe('deprecated stuff', function() { it ('should throw an error when using deprecated setting number.precision', function () { assert.throws(function () { - math({ + math.create({ number: { precision: 14 } @@ -27,7 +27,7 @@ describe('deprecated stuff', function() { it ('should throw an error when using deprecated setting decimals', function () { assert.throws(function () { - math({ + math.create({ decimals: 100 }) }, /is deprecated/); @@ -35,7 +35,7 @@ describe('deprecated stuff', function() { it ('should throw an error when using deprecated setting matrix.defaultType', function () { assert.throws(function () { - math({ + math.create({ matrix: { defaultType: 'array' } @@ -45,7 +45,7 @@ describe('deprecated stuff', function() { it ('should throw an error when using deprecated setting matrix.default', function () { assert.throws(function () { - math({ + math.create({ matrix: { 'default': 'array' } diff --git a/test/expression/Parser.test.js b/test/expression/Parser.test.js index 2cfa59064..e11c665c5 100644 --- a/test/expression/Parser.test.js +++ b/test/expression/Parser.test.js @@ -3,7 +3,7 @@ var assert = require('assert'), approx = require('../../tools/approx'), Parser = require('../../lib/expression/Parser'), - math = require('../../index')(); + math = require('../../index'); describe('parser', function() { diff --git a/test/expression/node/ArrayNode.test.js b/test/expression/node/ArrayNode.test.js index cd3e90689..6dc85f6e0 100644 --- a/test/expression/node/ArrayNode.test.js +++ b/test/expression/node/ArrayNode.test.js @@ -48,7 +48,7 @@ describe('ArrayNode', function() { var expr = n.compile(math); assert.deepEqual(expr.eval(), math.matrix([1,2,3,4])); - var mathArray = math({matrix: 'array'}); + var mathArray = math.create({matrix: 'array'}); var expr2 = n.compile(mathArray); assert.deepEqual(expr2.eval(), [1,2,3,4]); }); diff --git a/test/expression/node/AssignmentNode.test.js b/test/expression/node/AssignmentNode.test.js index 146acb2c5..390d73b8d 100644 --- a/test/expression/node/AssignmentNode.test.js +++ b/test/expression/node/AssignmentNode.test.js @@ -1,7 +1,7 @@ // test AssignmentNode var assert = require('assert'), approx = require('../../../tools/approx'), - math = require('../../../index')(), + math = require('../../../index'), Node = require('../../../lib/expression/node/Node'), ConstantNode = require('../../../lib/expression/node/ConstantNode'), SymbolNode = require('../../../lib/expression/node/SymbolNode'), diff --git a/test/expression/node/BlockNode.test.js b/test/expression/node/BlockNode.test.js index 406481a76..540c702f3 100644 --- a/test/expression/node/BlockNode.test.js +++ b/test/expression/node/BlockNode.test.js @@ -1,7 +1,7 @@ // test BlockNode var assert = require('assert'); var approx = require('../../../tools/approx'); -var math = require('../../../index')(); +var math = require('../../../index'); var Node = require('../../../lib/expression/node/Node'); var ConstantNode = require('../../../lib/expression/node/ConstantNode'); var SymbolNode = require('../../../lib/expression/node/SymbolNode'); diff --git a/test/expression/node/ConditionalNode.test.js b/test/expression/node/ConditionalNode.test.js index ef96d774c..8bff5bcd5 100644 --- a/test/expression/node/ConditionalNode.test.js +++ b/test/expression/node/ConditionalNode.test.js @@ -1,7 +1,7 @@ // test ConditionalNode var assert = require('assert'), approx = require('../../../tools/approx'), - math = require('../../../index')(), + math = require('../../../index'), Node = require('../../../lib/expression/node/Node'), ConstantNode = require('../../../lib/expression/node/ConstantNode'), SymbolNode = require('../../../lib/expression/node/SymbolNode'), diff --git a/test/expression/node/ConstantNode.test.js b/test/expression/node/ConstantNode.test.js index d6d6e00ad..1c4044a5a 100644 --- a/test/expression/node/ConstantNode.test.js +++ b/test/expression/node/ConstantNode.test.js @@ -1,8 +1,8 @@ // test ConstantNode var assert = require('assert'), approx = require('../../../tools/approx'), - math = require('../../../index')(), - bigmath = require('../../../index')({number: 'bignumber'}), + math = require('../../../index'), + bigmath = require('../../../index').create({number: 'bignumber'}), Node = require('../../../lib/expression/node/Node'), ConstantNode = require('../../../lib/expression/node/ConstantNode'), SymbolNode = require('../../../lib/expression/node/SymbolNode'); diff --git a/test/expression/node/FunctionAssignmentNode.test.js b/test/expression/node/FunctionAssignmentNode.test.js index 04cc89221..2b34a0a99 100644 --- a/test/expression/node/FunctionAssignmentNode.test.js +++ b/test/expression/node/FunctionAssignmentNode.test.js @@ -1,7 +1,7 @@ // test FunctionAssignmentNode var assert = require('assert'), approx = require('../../../tools/approx'), - math = require('../../../index')(), + math = require('../../../index'), Node = require('../../../lib/expression/node/Node'), ConstantNode = require('../../../lib/expression/node/ConstantNode'), OperatorNode = require('../../../lib/expression/node/OperatorNode'), diff --git a/test/expression/node/FunctionNode.test.js b/test/expression/node/FunctionNode.test.js index 1d0ec440d..e01863e84 100644 --- a/test/expression/node/FunctionNode.test.js +++ b/test/expression/node/FunctionNode.test.js @@ -1,7 +1,7 @@ // test FunctionNode var assert = require('assert'), approx = require('../../../tools/approx'), - math = require('../../../index')(), + math = require('../../../index'), Node = require('../../../lib/expression/node/Node'), ConstantNode = require('../../../lib/expression/node/ConstantNode'), SymbolNode = require('../../../lib/expression/node/SymbolNode'), diff --git a/test/expression/node/IndexNode.test.js b/test/expression/node/IndexNode.test.js index cf4fc2463..9075d80e0 100644 --- a/test/expression/node/IndexNode.test.js +++ b/test/expression/node/IndexNode.test.js @@ -1,7 +1,7 @@ // test IndexNode var assert = require('assert'), approx = require('../../../tools/approx'), - bigmath = require('../../../index')({number: 'bignumber'}), + bigmath = require('../../../index').create({number: 'bignumber'}), Node = require('../../../lib/expression/node/Node'), ConstantNode = require('../../../lib/expression/node/ConstantNode'), RangeNode = require('../../../lib/expression/node/RangeNode'), diff --git a/test/expression/node/Node.test.js b/test/expression/node/Node.test.js index ed2987668..254dfb0cd 100644 --- a/test/expression/node/Node.test.js +++ b/test/expression/node/Node.test.js @@ -1,7 +1,7 @@ // test Node var assert = require('assert'), approx = require('../../../tools/approx'), - math = require('../../../index')(), + math = require('../../../index'), Node = require('../../../lib/expression/node/Node'); describe('Node', function() { diff --git a/test/expression/node/OperatorNode.test.js b/test/expression/node/OperatorNode.test.js index ff2173047..4e847c0bc 100644 --- a/test/expression/node/OperatorNode.test.js +++ b/test/expression/node/OperatorNode.test.js @@ -1,7 +1,7 @@ // test OperatorNode var assert = require('assert'), approx = require('../../../tools/approx'), - math = require('../../../index')(), + math = require('../../../index'), Node = require('../../../lib/expression/node/Node'), ConstantNode = require('../../../lib/expression/node/ConstantNode'), SymbolNode = require('../../../lib/expression/node/SymbolNode'), diff --git a/test/expression/node/SymbolNode.test.js b/test/expression/node/SymbolNode.test.js index 487c6da52..9776d44e9 100644 --- a/test/expression/node/SymbolNode.test.js +++ b/test/expression/node/SymbolNode.test.js @@ -1,7 +1,7 @@ // test SymbolNode var assert = require('assert'), approx = require('../../../tools/approx'), - math = require('../../../index')(), + math = require('../../../index'), Node = require('../../../lib/expression/node/Node'), ConstantNode = require('../../../lib/expression/node/ConstantNode'), SymbolNode = require('../../../lib/expression/node/SymbolNode'); diff --git a/test/expression/node/UpdateNode.test.js b/test/expression/node/UpdateNode.test.js index 0350c125c..5d9b79d23 100644 --- a/test/expression/node/UpdateNode.test.js +++ b/test/expression/node/UpdateNode.test.js @@ -2,7 +2,7 @@ var assert = require('assert'), approx = require('../../../tools/approx'), math = require('../../../index'), - bigmath = math({number: 'bignumber'}), + bigmath = math.create({number: 'bignumber'}), Node = require('../../../lib/expression/node/Node'), ConstantNode = require('../../../lib/expression/node/ConstantNode'), RangeNode = require('../../../lib/expression/node/RangeNode'), diff --git a/test/expression/parse.test.js b/test/expression/parse.test.js index 10e2a2e9e..4f90bb130 100644 --- a/test/expression/parse.test.js +++ b/test/expression/parse.test.js @@ -147,7 +147,7 @@ describe('parse', function() { }); it('should output bignumbers if default number type is bignumber', function() { - var bigmath = math({ + var bigmath = math.create({ number: 'bignumber' }); @@ -1007,7 +1007,7 @@ describe('parse', function() { }); describe('bignumber', function () { - var bigmath = math({ + var bigmath = math.create({ number: 'bignumber' }); var BigNumber = bigmath.type.BigNumber; diff --git a/test/function/arithmetic/abs.test.js b/test/function/arithmetic/abs.test.js index 865d0edf4..12e2f5d9d 100644 --- a/test/function/arithmetic/abs.test.js +++ b/test/function/arithmetic/abs.test.js @@ -1,7 +1,7 @@ // test abs var assert = require('assert'), error = require('../../../lib/error'), - math = require('../../../index')(); + math = require('../../../index'); describe('abs', function () { it('should return the abs value of a boolean', function () { diff --git a/test/function/arithmetic/add.test.js b/test/function/arithmetic/add.test.js index 0583751fe..dd77cf6d1 100644 --- a/test/function/arithmetic/add.test.js +++ b/test/function/arithmetic/add.test.js @@ -2,7 +2,7 @@ var assert = require('assert'), approx = require('../../../tools/approx'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), bignumber = math.bignumber, add = math.add; diff --git a/test/function/arithmetic/ceil.test.js b/test/function/arithmetic/ceil.test.js index 5c527fa8b..66547867f 100644 --- a/test/function/arithmetic/ceil.test.js +++ b/test/function/arithmetic/ceil.test.js @@ -2,7 +2,7 @@ var assert = require('assert'), approx = require('../../../tools/approx'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), bignumber = math.bignumber, complex = math.complex, matrix = math.matrix, diff --git a/test/function/arithmetic/cube.test.js b/test/function/arithmetic/cube.test.js index b045840df..f5bfcc4ee 100644 --- a/test/function/arithmetic/cube.test.js +++ b/test/function/arithmetic/cube.test.js @@ -1,6 +1,6 @@ // test cube var assert = require('assert'), - math = require('../../../index')(), + math = require('../../../index'), error = require('../../../lib/error/index'), unit = math.unit, bignumber = math.bignumber, diff --git a/test/function/arithmetic/divide.test.js b/test/function/arithmetic/divide.test.js index e9333c367..2e82ccfc7 100644 --- a/test/function/arithmetic/divide.test.js +++ b/test/function/arithmetic/divide.test.js @@ -1,6 +1,6 @@ // test divide var assert = require('assert'), - math = require('../../../index')(), + math = require('../../../index'), error = require('../../../lib/error/index'), approx = require('../../../tools/approx'), divide = math.divide, diff --git a/test/function/arithmetic/dotDivide.test.js b/test/function/arithmetic/dotDivide.test.js index 947e829ab..355b36f6d 100644 --- a/test/function/arithmetic/dotDivide.test.js +++ b/test/function/arithmetic/dotDivide.test.js @@ -1,6 +1,6 @@ // test dotDivide (element-wise divide) var assert = require('assert'), - math = require('../../../index')(), + math = require('../../../index'), error = require('../../../lib/error/index'), approx = require('../../../tools/approx'), dotDivide = math.dotDivide, diff --git a/test/function/arithmetic/dotMultiply.test.js b/test/function/arithmetic/dotMultiply.test.js index 5155f781c..d4372cfa5 100644 --- a/test/function/arithmetic/dotMultiply.test.js +++ b/test/function/arithmetic/dotMultiply.test.js @@ -1,6 +1,6 @@ // test dotMultiply (element-wise multiply) var assert = require('assert'), - math = require('../../../index')(), + math = require('../../../index'), approx = require('../../../tools/approx'), error = require('../../../lib/error/index'), dotMultiply = math.dotMultiply, diff --git a/test/function/arithmetic/dotPow.test.js b/test/function/arithmetic/dotPow.test.js index fc66957fe..1befb2117 100644 --- a/test/function/arithmetic/dotPow.test.js +++ b/test/function/arithmetic/dotPow.test.js @@ -2,7 +2,7 @@ var assert = require('assert'), approx = require('../../../tools/approx'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), complex = math.complex, matrix = math.matrix, unit = math.unit, diff --git a/test/function/arithmetic/exp.test.js b/test/function/arithmetic/exp.test.js index 6e03d5f96..77d8f0cc6 100644 --- a/test/function/arithmetic/exp.test.js +++ b/test/function/arithmetic/exp.test.js @@ -27,7 +27,7 @@ describe('exp', function() { }); it('should exponentiate a bignumber', function() { - var bigmath = math({precision: 100}); + var bigmath = math.create({precision: 100}); assert.deepEqual(bigmath.exp(bigmath.bignumber(1)), bigmath.bignumber('2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427')); }); diff --git a/test/function/arithmetic/fix.test.js b/test/function/arithmetic/fix.test.js index e2b1879cf..f83157f22 100644 --- a/test/function/arithmetic/fix.test.js +++ b/test/function/arithmetic/fix.test.js @@ -2,7 +2,7 @@ var assert = require('assert'), error = require('../../../lib/error/index'), approx = require('../../../tools/approx'), - math = require('../../../index')(), + math = require('../../../index'), bignumber = math.bignumber, complex = math.complex, matrix = math.matrix, diff --git a/test/function/arithmetic/floor.test.js b/test/function/arithmetic/floor.test.js index 975ee06cb..3330dad36 100644 --- a/test/function/arithmetic/floor.test.js +++ b/test/function/arithmetic/floor.test.js @@ -2,7 +2,7 @@ var assert = require('assert'), approx = require('../../../tools/approx'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), bignumber = math.bignumber, complex = math.complex, matrix = math.matrix, diff --git a/test/function/arithmetic/gcd.test.js b/test/function/arithmetic/gcd.test.js index 7fb88a020..a2c82880c 100644 --- a/test/function/arithmetic/gcd.test.js +++ b/test/function/arithmetic/gcd.test.js @@ -1,7 +1,7 @@ // test gcd var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), gcd = math.gcd; describe('gcd', function() { diff --git a/test/function/arithmetic/lcm.test.js b/test/function/arithmetic/lcm.test.js index 04cd4c30f..bf2bf186d 100644 --- a/test/function/arithmetic/lcm.test.js +++ b/test/function/arithmetic/lcm.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), lcm = math.lcm; describe('lcm', function() { diff --git a/test/function/arithmetic/log.test.js b/test/function/arithmetic/log.test.js index f7e55045f..a272b1e68 100644 --- a/test/function/arithmetic/log.test.js +++ b/test/function/arithmetic/log.test.js @@ -45,7 +45,7 @@ describe('log', function() { }); it('should return the log of positive bignumbers', function() { - var bigmath = math({precision: 100}); + var bigmath = math.create({precision: 100}); assert.deepEqual(bigmath.log(bigmath.bignumber(1)), bigmath.bignumber('0')); assert.deepEqual(bigmath.log(bigmath.bignumber(2)), bigmath.bignumber('0.6931471805599453094172321214581765680755001343602552541206800094933936219696947156058633269964186875')); @@ -56,7 +56,7 @@ describe('log', function() { }); it('should return the log of negative bignumbers', function() { - var bigmath = math({precision: 100}); + var bigmath = math.create({precision: 100}); approx.deepEqual(bigmath.log(bigmath.bignumber(-1)), bigmath.complex('0.000000000000000 + 3.141592653589793i')); approx.deepEqual(bigmath.log(bigmath.bignumber(-2)), bigmath.complex('0.693147180559945 + 3.141592653589793i')); @@ -64,7 +64,7 @@ describe('log', function() { }); it('should return the log of a bignumber with value zero', function() { - var bigmath = math({precision: 100}); + var bigmath = math.create({precision: 100}); assert.deepEqual(bigmath.log(bigmath.bignumber(0)), bigmath.bignumber(-Infinity)); }); diff --git a/test/function/arithmetic/log10.test.js b/test/function/arithmetic/log10.test.js index 6385a00fc..e6a8db40f 100644 --- a/test/function/arithmetic/log10.test.js +++ b/test/function/arithmetic/log10.test.js @@ -39,7 +39,7 @@ describe('log10', function() { }); it('should return the log of positive bignumbers', function() { - var bigmath = math({precision: 100}); + var bigmath = math.create({precision: 100}); assert.deepEqual(bigmath.log10(bigmath.bignumber(1)), bigmath.bignumber(0)); assert.deepEqual(bigmath.log10(bigmath.bignumber(10)), bigmath.bignumber(1)); @@ -50,7 +50,7 @@ describe('log10', function() { }); it('should return the log of negative bignumbers', function() { - var bigmath = math({precision: 100}); + var bigmath = math.create({precision: 100}); approx.deepEqual(bigmath.log10(bigmath.bignumber(-1)), bigmath.complex('0.000000000000000 + 1.364376353841841i')); approx.deepEqual(bigmath.log10(bigmath.bignumber(-2)), bigmath.complex('0.301029995663981 + 1.364376353841841i')); @@ -58,7 +58,7 @@ describe('log10', function() { }); it('should return the log of a bignumber with value zero', function() { - var bigmath = math({precision: 100}); + var bigmath = math.create({precision: 100}); assert.deepEqual(bigmath.log10(bigmath.bignumber(0)), bigmath.bignumber(-Infinity)); }); diff --git a/test/function/arithmetic/mod.test.js b/test/function/arithmetic/mod.test.js index 4f6483ebe..d0c6f900d 100644 --- a/test/function/arithmetic/mod.test.js +++ b/test/function/arithmetic/mod.test.js @@ -2,7 +2,7 @@ var assert = require('assert'), approx = require('../../../tools/approx'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), bignumber = math.bignumber, matrix = math.matrix, range = math.range, diff --git a/test/function/arithmetic/multiply.test.js b/test/function/arithmetic/multiply.test.js index 34e9ffb9f..157731b14 100644 --- a/test/function/arithmetic/multiply.test.js +++ b/test/function/arithmetic/multiply.test.js @@ -1,6 +1,6 @@ // test multiply var assert = require('assert'), - math = require('../../../index')(), + math = require('../../../index'), error = require('../../../lib/error/index'), approx = require('../../../tools/approx'), multiply = math.multiply, diff --git a/test/function/arithmetic/norm.test.js b/test/function/arithmetic/norm.test.js index d507d3896..17a5975ac 100644 --- a/test/function/arithmetic/norm.test.js +++ b/test/function/arithmetic/norm.test.js @@ -1,7 +1,7 @@ // test norm var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(); + math = require('../../../index'); describe('norm', function () { diff --git a/test/function/arithmetic/pow.test.js b/test/function/arithmetic/pow.test.js index d45251517..0430c51b5 100644 --- a/test/function/arithmetic/pow.test.js +++ b/test/function/arithmetic/pow.test.js @@ -2,7 +2,7 @@ var assert = require('assert'), approx = require('../../../tools/approx'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), bignumber = math.bignumber, complex = math.complex, matrix = math.matrix, diff --git a/test/function/arithmetic/round.test.js b/test/function/arithmetic/round.test.js index 97f5b7168..96770d1b5 100644 --- a/test/function/arithmetic/round.test.js +++ b/test/function/arithmetic/round.test.js @@ -2,7 +2,7 @@ var assert = require('assert'), approx = require('../../../tools/approx'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), bignumber = math.bignumber, round = math.round; diff --git a/test/function/arithmetic/sign.test.js b/test/function/arithmetic/sign.test.js index 1d43c1fcb..9d2ac7778 100644 --- a/test/function/arithmetic/sign.test.js +++ b/test/function/arithmetic/sign.test.js @@ -2,7 +2,7 @@ var assert = require('assert'), approx = require('../../../tools/approx'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), bignumber = math.bignumber; describe('sign', function() { diff --git a/test/function/arithmetic/sqrt.test.js b/test/function/arithmetic/sqrt.test.js index fa479d1e7..8d7a03c87 100644 --- a/test/function/arithmetic/sqrt.test.js +++ b/test/function/arithmetic/sqrt.test.js @@ -35,7 +35,7 @@ describe('sqrt', function() { assert.deepEqual(sqrt(bignumber(25)), bignumber(5)); // validate whether we are really working at high precision - var bigmath = math({precision: 100}); + var bigmath = math.create({precision: 100}); assert.deepEqual(bigmath.sqrt(bigmath.bignumber(2)), bigmath.bignumber('1.414213562373095048801688724209698078569671875376948073176679737990732478462107038850387534327641573')); }); diff --git a/test/function/arithmetic/square.test.js b/test/function/arithmetic/square.test.js index 7d0f2243d..242464e58 100644 --- a/test/function/arithmetic/square.test.js +++ b/test/function/arithmetic/square.test.js @@ -1,6 +1,6 @@ // test square var assert = require('assert'), - math = require('../../../index')(), + math = require('../../../index'), error = require('../../../lib/error/index'), unit = math.unit, bignumber = math.bignumber, diff --git a/test/function/arithmetic/subtract.test.js b/test/function/arithmetic/subtract.test.js index 8828a6bd3..f7143ba8e 100644 --- a/test/function/arithmetic/subtract.test.js +++ b/test/function/arithmetic/subtract.test.js @@ -2,7 +2,7 @@ var assert = require('assert'), approx = require('../../../tools/approx'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), bignumber = math.bignumber, subtract = math.subtract; diff --git a/test/function/arithmetic/unaryMinus.test.js b/test/function/arithmetic/unaryMinus.test.js index 60b72d3b6..a100ca75a 100644 --- a/test/function/arithmetic/unaryMinus.test.js +++ b/test/function/arithmetic/unaryMinus.test.js @@ -11,7 +11,7 @@ describe('unaryMinus', function() { }); it('should return bignumber unary minus of a boolean', function () { - var bigmath = math({number: 'bignumber'}); + var bigmath = math.create({number: 'bignumber'}); assert.deepEqual(bigmath.unaryMinus(true), bigmath.bignumber(-1)); assert.deepEqual(bigmath.unaryMinus(false), bigmath.bignumber(-0)); }); @@ -22,7 +22,7 @@ describe('unaryMinus', function() { }); it('should return bignumber unary minus on a string', function() { - var bigmath = math({number: 'bignumber'}); + var bigmath = math.create({number: 'bignumber'}); assert.deepEqual(bigmath.unaryMinus('2'), bigmath.bignumber(-2)); assert.deepEqual(bigmath.unaryMinus('-2'), bigmath.bignumber(2)); }); diff --git a/test/function/arithmetic/unaryPlus.test.js b/test/function/arithmetic/unaryPlus.test.js index 861039af1..b00110ecd 100644 --- a/test/function/arithmetic/unaryPlus.test.js +++ b/test/function/arithmetic/unaryPlus.test.js @@ -11,7 +11,7 @@ describe('unaryPlus', function() { }); it('should return bignumber unary plus of a boolean', function () { - var bigmath = math({number: 'bignumber'}); + var bigmath = math.create({number: 'bignumber'}); assert.deepEqual(bigmath.unaryPlus(true), bigmath.bignumber(1)); assert.deepEqual(bigmath.unaryPlus(false), bigmath.bignumber(0)); }); @@ -22,7 +22,7 @@ describe('unaryPlus', function() { }); it('should return bignumber unary plus on a string', function() { - var bigmath = math({number: 'bignumber'}); + var bigmath = math.create({number: 'bignumber'}); assert.deepEqual(bigmath.unaryPlus('2'), bigmath.bignumber(2)); assert.deepEqual(bigmath.unaryPlus('-2'), bigmath.bignumber(-2)); }); diff --git a/test/function/arithmetic/xgcd.test.js b/test/function/arithmetic/xgcd.test.js index 81689e98d..04f280330 100644 --- a/test/function/arithmetic/xgcd.test.js +++ b/test/function/arithmetic/xgcd.test.js @@ -1,7 +1,7 @@ // test xgcd var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')({matrix: 'array'}), + math = require('../../../index').create({matrix: 'array'}), gcd = math.gcd, xgcd = math.xgcd; @@ -73,10 +73,10 @@ describe('xgcd', function() { }); it('should return a matrix when configured to use matrices', function() { - var math1 = math({matrix: 'matrix'}); + var math1 = math.create({matrix: 'matrix'}); assert.deepEqual(math1.xgcd(65, 40), math.matrix([5, -3, 5])); - var math2 = math({matrix: 'array'}); + var math2 = math.create({matrix: 'array'}); assert.deepEqual(math2.xgcd(65, 40), [5, -3, 5]); }); diff --git a/test/function/complex/arg.test.js b/test/function/complex/arg.test.js index 12c820ec2..35eeec497 100644 --- a/test/function/complex/arg.test.js +++ b/test/function/complex/arg.test.js @@ -1,7 +1,7 @@ var assert = require('assert'), error = require('../../../lib/error/index'), approx = require('../../../tools/approx'), - math = require('../../../index')(), + math = require('../../../index'), arg = math.arg; describe('arg', function() { diff --git a/test/function/complex/conj.test.js b/test/function/complex/conj.test.js index 31d4ca01c..1b701a8bd 100644 --- a/test/function/complex/conj.test.js +++ b/test/function/complex/conj.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), conj = math.conj; describe('conj', function() { diff --git a/test/function/complex/im.test.js b/test/function/complex/im.test.js index a11b09f6b..4d8bc6ca7 100644 --- a/test/function/complex/im.test.js +++ b/test/function/complex/im.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(); + math = require('../../../index'); describe('im', function() { diff --git a/test/function/complex/re.test.js b/test/function/complex/re.test.js index 7d69be21b..3f59911ae 100644 --- a/test/function/complex/re.test.js +++ b/test/function/complex/re.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(); + math = require('../../../index'); describe('re', function() { diff --git a/test/function/construction/bignumber.test.js b/test/function/construction/bignumber.test.js index 13cf9e6bb..4fe3eab84 100644 --- a/test/function/construction/bignumber.test.js +++ b/test/function/construction/bignumber.test.js @@ -53,7 +53,7 @@ describe('bignumber', function() { }); it('should apply precision setting to bignumbers', function() { - var mymath = math({ + var mymath = math.create({ precision: 32 }); diff --git a/test/function/construction/boolean.test.js b/test/function/construction/boolean.test.js index 2810bf8e4..a898759fd 100644 --- a/test/function/construction/boolean.test.js +++ b/test/function/construction/boolean.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), bool = math['boolean']; describe('boolean', function() { diff --git a/test/function/construction/complex.test.js b/test/function/construction/complex.test.js index 33f014ea4..07653a6ed 100644 --- a/test/function/construction/complex.test.js +++ b/test/function/construction/complex.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), complex = math.complex; describe('complex', function() { diff --git a/test/function/construction/index.test.js b/test/function/construction/index.test.js index 6bb153487..1ca79d925 100644 --- a/test/function/construction/index.test.js +++ b/test/function/construction/index.test.js @@ -1,7 +1,7 @@ // test index construction var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(); + math = require('../../../index'); describe('index', function() { diff --git a/test/function/construction/matrix.test.js b/test/function/construction/matrix.test.js index 3e41dda5b..9bfec496d 100644 --- a/test/function/construction/matrix.test.js +++ b/test/function/construction/matrix.test.js @@ -1,7 +1,7 @@ // test matrix construction var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), matrix = math.matrix; describe('matrix', function() { diff --git a/test/function/construction/number.test.js b/test/function/construction/number.test.js index e6b3d9dab..ad7af2fca 100644 --- a/test/function/construction/number.test.js +++ b/test/function/construction/number.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), approx = require('../../../tools/approx'), number = math.number; diff --git a/test/function/construction/parser.test.js b/test/function/construction/parser.test.js index 421ad5567..13498ebc2 100644 --- a/test/function/construction/parser.test.js +++ b/test/function/construction/parser.test.js @@ -1,7 +1,7 @@ var assert = require('assert'), error = require('../../../lib/error/index'), Parser = require('../../../lib/expression/Parser'), - math = require('../../../index')(); + math = require('../../../index'); describe('parser', function() { diff --git a/test/function/construction/select.test.js b/test/function/construction/select.test.js index 854d173d9..2ab6aaefc 100644 --- a/test/function/construction/select.test.js +++ b/test/function/construction/select.test.js @@ -1,5 +1,5 @@ var assert = require('assert'), - math = require('../../../index')(), + math = require('../../../index'), Selector = math.chaining.Selector; describe('select', function() { diff --git a/test/function/construction/string.test.js b/test/function/construction/string.test.js index 2d0f00841..36fd6146a 100644 --- a/test/function/construction/string.test.js +++ b/test/function/construction/string.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), string = math.string; describe('string', function() { diff --git a/test/function/construction/unit.test.js b/test/function/construction/unit.test.js index 37133ae0c..70e4a1ec9 100644 --- a/test/function/construction/unit.test.js +++ b/test/function/construction/unit.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), unit = math.unit; Unit = require('../../../lib/type/Unit'); diff --git a/test/function/expression/compile.test.js b/test/function/expression/compile.test.js index d13e04df9..7637e115c 100644 --- a/test/function/expression/compile.test.js +++ b/test/function/expression/compile.test.js @@ -1,7 +1,7 @@ // test parse var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), Node = require('../../../lib/expression/node/Node'); describe('parse', function() { diff --git a/test/function/expression/eval.test.js b/test/function/expression/eval.test.js index c6cc94b2a..51f6c7364 100644 --- a/test/function/expression/eval.test.js +++ b/test/function/expression/eval.test.js @@ -2,7 +2,7 @@ var assert = require('assert'); var approx = require('../../../tools/approx'); var error = require('../../../lib/error/index'); -var math = require('../../../index')(); +var math = require('../../../index'); var Complex = math.type.Complex; var Matrix = math.type.Matrix; var Unit = math.type.Unit; diff --git a/test/function/expression/help.test.js b/test/function/expression/help.test.js index 8325d7294..f1387db1c 100644 --- a/test/function/expression/help.test.js +++ b/test/function/expression/help.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(); + math = require('../../../index'); describe('help', function() { diff --git a/test/function/expression/parse.test.js b/test/function/expression/parse.test.js index b8de30993..89e4dec6c 100644 --- a/test/function/expression/parse.test.js +++ b/test/function/expression/parse.test.js @@ -1,7 +1,7 @@ // test parse var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), Node = require('../../../lib/expression/node/Node'); describe('parse', function() { diff --git a/test/function/matrix/concat.test.js b/test/function/matrix/concat.test.js index 412ef4b26..9f4cc8edc 100644 --- a/test/function/matrix/concat.test.js +++ b/test/function/matrix/concat.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), bignumber = math.bignumber; describe('concat', function() { diff --git a/test/function/matrix/det.test.js b/test/function/matrix/det.test.js index 5bda46fda..e2ea2ee8b 100644 --- a/test/function/matrix/det.test.js +++ b/test/function/matrix/det.test.js @@ -1,7 +1,7 @@ var assert = require('assert'), error = require('../../../lib/error/index'), approx = require('../../../tools/approx'), - math = require('../../../index')(); + math = require('../../../index'); describe('det', function() { diff --git a/test/function/matrix/diag.test.js b/test/function/matrix/diag.test.js index 6a1285c25..e750b6a3a 100644 --- a/test/function/matrix/diag.test.js +++ b/test/function/matrix/diag.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), bignumber = math.bignumber; describe('diag', function() { diff --git a/test/function/matrix/eye.test.js b/test/function/matrix/eye.test.js index 8b50289b2..a1602e465 100644 --- a/test/function/matrix/eye.test.js +++ b/test/function/matrix/eye.test.js @@ -33,7 +33,7 @@ describe('eye', function() { }); it('should return an array when setting matrix=="array"', function() { - var math2 = math({matrix: 'array'}); + var math2 = math.create({matrix: 'array'}); assert.deepEqual(math2.eye(2), [[1,0],[0,1]]); }); diff --git a/test/function/matrix/inv.test.js b/test/function/matrix/inv.test.js index 915978f70..26b3c887c 100644 --- a/test/function/matrix/inv.test.js +++ b/test/function/matrix/inv.test.js @@ -2,7 +2,7 @@ var assert = require('assert'), approx = require('../../../tools/approx'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), inv = math.inv; describe('inv', function() { diff --git a/test/function/matrix/ones.test.js b/test/function/matrix/ones.test.js index e8f365be5..18c9fd729 100644 --- a/test/function/matrix/ones.test.js +++ b/test/function/matrix/ones.test.js @@ -1,7 +1,7 @@ // test ones var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), ones = math.ones, matrix = math.matrix; diff --git a/test/function/matrix/range.test.js b/test/function/matrix/range.test.js index a0f05a848..3832165f3 100644 --- a/test/function/matrix/range.test.js +++ b/test/function/matrix/range.test.js @@ -43,7 +43,7 @@ describe('range', function() { }); it('should output an array when setting matrix==="array"', function() { - var math2 = math({ + var math2 = math.create({ matrix: 'array' }); @@ -79,14 +79,14 @@ describe('range', function() { }); it('should parse a range with bignumbers', function() { - var bigmath = math({number: 'bignumber'}); + var bigmath = math.create({number: 'bignumber'}); var bignumber = bigmath.bignumber; assert.deepEqual(bigmath.range('1:3'), matrix([bignumber(1),bignumber(2)])); assert.deepEqual(bigmath.range('3:-1:0'), matrix([bignumber(3),bignumber(2),bignumber(1)])); }); it('should throw an error when parsing a an invalid string to a bignumber range', function() { - var bigmath = math({number: 'bignumber'}); + var bigmath = math.create({number: 'bignumber'}); assert.throws(function () {bigmath.range('1:a')}, /is no valid range/); }); diff --git a/test/function/matrix/resize.test.js b/test/function/matrix/resize.test.js index 7e7b32abd..79ae32fa8 100644 --- a/test/function/matrix/resize.test.js +++ b/test/function/matrix/resize.test.js @@ -1,7 +1,7 @@ // test resize var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), Matrix = math.type.Matrix; describe('resize', function() { @@ -60,20 +60,20 @@ describe('resize', function() { }); it('should resize a scalar into an array when array is specified in settings', function() { - var math2 = math({matrix: 'array'}); + var math2 = math.create({matrix: 'array'}); assert.deepEqual(math2.resize(2, [3], 4), [2, 4, 4]); assert.deepEqual(math2.resize(2, [2,2], 4), [[2,4], [4,4]]); }); it('should resize a vector into a 2d matrix', function() { - var math2 = math({matrix: 'array'}); + var math2 = math.create({matrix: 'array'}); assert.deepEqual(math2.resize([1,2,3], [3,2], 0), [[1, 0], [2, 0], [3, 0]]); }); it('should resize 2d matrix into a vector', function() { - var math2 = math({matrix: 'array'}); + var math2 = math.create({matrix: 'array'}); assert.deepEqual(math2.resize([[1,2],[3,4],[5,6]], [3], 0), [1,3,5]); }); diff --git a/test/function/matrix/size.test.js b/test/function/matrix/size.test.js index c38037b4b..3aa74d71a 100644 --- a/test/function/matrix/size.test.js +++ b/test/function/matrix/size.test.js @@ -40,7 +40,7 @@ describe('size', function() { }); it('should calculate the size of a scalar with setting matrix=="array"', function() { - var math2 = math({matrix: 'array'}); + var math2 = math.create({matrix: 'array'}); assert.deepEqual(math2.size(2), []); assert.deepEqual(math2.size(math.bignumber(2)), []); assert.deepEqual(math2.size(math.complex(2,3)), []); diff --git a/test/function/matrix/squeeze.test.js b/test/function/matrix/squeeze.test.js index 70cdb9509..6ce7c6a93 100644 --- a/test/function/matrix/squeeze.test.js +++ b/test/function/matrix/squeeze.test.js @@ -1,7 +1,7 @@ // test squeeze var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), squeeze = math.squeeze, size = math.size, matrix = math.matrix; diff --git a/test/function/matrix/subset.test.js b/test/function/matrix/subset.test.js index 7cc34a850..b93226a7c 100644 --- a/test/function/matrix/subset.test.js +++ b/test/function/matrix/subset.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), subset = math.subset, matrix = math.matrix, range = math.range, diff --git a/test/function/matrix/transpose.test.js b/test/function/matrix/transpose.test.js index 4b8612248..b15bdd2ec 100644 --- a/test/function/matrix/transpose.test.js +++ b/test/function/matrix/transpose.test.js @@ -1,7 +1,7 @@ // test transpose var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), transpose = math.transpose; describe('transpose', function() { diff --git a/test/function/matrix/zeros.test.js b/test/function/matrix/zeros.test.js index cc135d98c..3c9433b22 100644 --- a/test/function/matrix/zeros.test.js +++ b/test/function/matrix/zeros.test.js @@ -1,7 +1,7 @@ // test zeros var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), zeros = math.zeros, matrix = math.matrix; diff --git a/test/function/probability/combinations.test.js b/test/function/probability/combinations.test.js index 898cc2ab1..34d2438c4 100644 --- a/test/function/probability/combinations.test.js +++ b/test/function/probability/combinations.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), combinations = math.combinations; describe('combinations', function() { diff --git a/test/function/probability/distribution.test.js b/test/function/probability/distribution.test.js index a1f0664bf..3733e2758 100644 --- a/test/function/probability/distribution.test.js +++ b/test/function/probability/distribution.test.js @@ -3,7 +3,7 @@ var assert = require('assert'), seed = require('seed-random'), _ = require('underscore'), Matrix = require('../../../lib/type/Matrix'), - math = require('../../../index')(); + math = require('../../../index'); var assertApproxEqual = function(testVal, val, tolerance) { var diff = Math.abs(val - testVal); diff --git a/test/function/probability/factorial.test.js b/test/function/probability/factorial.test.js index 71fb42fbc..90c83b0a9 100644 --- a/test/function/probability/factorial.test.js +++ b/test/function/probability/factorial.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), factorial = math.factorial; describe('factorial', function() { diff --git a/test/function/probability/permutations.test.js b/test/function/probability/permutations.test.js index 2de6a8c7a..77a700496 100644 --- a/test/function/probability/permutations.test.js +++ b/test/function/probability/permutations.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), permutations = math.permutations; describe('permutations', function() { diff --git a/test/function/probability/pickRandom.test.js b/test/function/probability/pickRandom.test.js index 91b944017..eb4b0536c 100644 --- a/test/function/probability/pickRandom.test.js +++ b/test/function/probability/pickRandom.test.js @@ -1,5 +1,5 @@ var assert = require('assert'), - math = require('../../../index')(); + math = require('../../../index'); describe('pickRandom', function () { // Note: pickRandom is a convenience function generated by distribution diff --git a/test/function/probability/random.test.js b/test/function/probability/random.test.js index ae9019a22..145855fb8 100644 --- a/test/function/probability/random.test.js +++ b/test/function/probability/random.test.js @@ -1,5 +1,5 @@ var assert = require('assert'), - math = require('../../../index')(); + math = require('../../../index'); describe('random', function () { // Note: random is a convenience function generated by distribution diff --git a/test/function/probability/randomInt.test.js b/test/function/probability/randomInt.test.js index 75dd94d63..13d753a68 100644 --- a/test/function/probability/randomInt.test.js +++ b/test/function/probability/randomInt.test.js @@ -1,5 +1,5 @@ var assert = require('assert'), - math = require('../../../index')(); + math = require('../../../index'); describe('randomInt', function () { // Note: randomInt is a convenience function generated by distribution diff --git a/test/function/relational/compare.test.js b/test/function/relational/compare.test.js index a0ce84022..e17a42647 100644 --- a/test/function/relational/compare.test.js +++ b/test/function/relational/compare.test.js @@ -106,7 +106,7 @@ describe('compare', function() { }); it('should apply configuration option epsilon', function() { - var mymath = math(); + var mymath = math.create(); assert.equal(mymath.compare(1, 0.991), 1); mymath.config({epsilon: 1e-2}); assert.equal(mymath.compare(1, 0.991), 0); diff --git a/test/function/relational/equal.test.js b/test/function/relational/equal.test.js index 58821bc05..095f43493 100644 --- a/test/function/relational/equal.test.js +++ b/test/function/relational/equal.test.js @@ -119,7 +119,7 @@ describe('equal', function() { }); it('should apply configuration option epsilon', function() { - var mymath = math(); + var mymath = math.create(); assert.equal(mymath.equal(1, 0.991), false); mymath.config({epsilon: 1e-2}); assert.equal(mymath.equal(1, 0.991), true); diff --git a/test/function/relational/larger.test.js b/test/function/relational/larger.test.js index bb6864747..8303f8316 100644 --- a/test/function/relational/larger.test.js +++ b/test/function/relational/larger.test.js @@ -79,7 +79,7 @@ describe('larger', function() { }); it('should apply configuration option epsilon', function() { - var mymath = math(); + var mymath = math.create(); assert.equal(mymath.larger(1, 0.991), true); mymath.config({epsilon: 1e-2}); assert.equal(mymath.larger(1, 0.991), false); diff --git a/test/function/relational/largerEq.test.js b/test/function/relational/largerEq.test.js index 8592aa725..6fbd51482 100644 --- a/test/function/relational/largerEq.test.js +++ b/test/function/relational/largerEq.test.js @@ -82,7 +82,7 @@ describe('largerEq', function() { }); it('should apply configuration option epsilon', function() { - var mymath = math(); + var mymath = math.create(); assert.equal(mymath.largerEq(1, 1.01), false); mymath.config({epsilon: 1e-2}); assert.equal(mymath.largerEq(1, 1.01), true); diff --git a/test/function/relational/smaller.test.js b/test/function/relational/smaller.test.js index 36a797879..e9415fda3 100644 --- a/test/function/relational/smaller.test.js +++ b/test/function/relational/smaller.test.js @@ -84,7 +84,7 @@ describe('smaller', function() { }); it('should apply configuration option epsilon', function() { - var mymath = math(); + var mymath = math.create(); assert.equal(mymath.smaller(0.991, 1), true); mymath.config({epsilon: 1e-2}); assert.equal(mymath.smaller(0.991, 1), false); diff --git a/test/function/relational/smallerEq.test.js b/test/function/relational/smallerEq.test.js index b7dc50175..8a5fb489e 100644 --- a/test/function/relational/smallerEq.test.js +++ b/test/function/relational/smallerEq.test.js @@ -85,7 +85,7 @@ describe('smallerEq', function() { }); it('should apply configuration option epsilon', function() { - var mymath = math(); + var mymath = math.create(); assert.equal(mymath.smallerEq(1.01, 1), false); mymath.config({epsilon: 1e-2}); assert.equal(mymath.smallerEq(1.01, 1), true); diff --git a/test/function/relational/unequal.test.js b/test/function/relational/unequal.test.js index f04758522..3a663efd2 100644 --- a/test/function/relational/unequal.test.js +++ b/test/function/relational/unequal.test.js @@ -122,7 +122,7 @@ describe('unequal', function() { }); it('should apply configuration option epsilon', function() { - var mymath = math(); + var mymath = math.create(); assert.equal(mymath.unequal(1, 0.991), true); mymath.config({epsilon: 1e-2}); assert.equal(mymath.unequal(1, 0.991), false); diff --git a/test/function/statistics/max.test.js b/test/function/statistics/max.test.js index 358b0fc46..68136e7ab 100644 --- a/test/function/statistics/max.test.js +++ b/test/function/statistics/max.test.js @@ -1,5 +1,5 @@ var assert = require('assert'), - math = require('../../../index')(), + math = require('../../../index'), bignumber = math.bignumber, max = math.max; diff --git a/test/function/statistics/mean.test.js b/test/function/statistics/mean.test.js index 634fb00d1..7379e970a 100644 --- a/test/function/statistics/mean.test.js +++ b/test/function/statistics/mean.test.js @@ -1,5 +1,5 @@ var assert = require('assert'), - math = require('../../../index')(), + math = require('../../../index'), bignumber = math.bignumber, mean = math.mean; diff --git a/test/function/statistics/median.test.js b/test/function/statistics/median.test.js index 1bd29e432..bf84dab02 100644 --- a/test/function/statistics/median.test.js +++ b/test/function/statistics/median.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), approx = require('../../../tools/approx'), - math = require('../../../index')(), + math = require('../../../index'), bignumber = math.bignumber, median = math.median; diff --git a/test/function/statistics/min.test.js b/test/function/statistics/min.test.js index a07b96432..d8ad18bfc 100644 --- a/test/function/statistics/min.test.js +++ b/test/function/statistics/min.test.js @@ -1,5 +1,5 @@ var assert = require('assert'), - math = require('../../../index')(), + math = require('../../../index'), bignumber = math.bignumber, min = math.min; diff --git a/test/function/statistics/prod.test.js b/test/function/statistics/prod.test.js index f867b6213..7159fa7aa 100644 --- a/test/function/statistics/prod.test.js +++ b/test/function/statistics/prod.test.js @@ -1,5 +1,5 @@ var assert = require('assert'), - math = require('../../../index')(), + math = require('../../../index'), bignumber = math.bignumber, prod = math.prod; diff --git a/test/function/statistics/std.test.js b/test/function/statistics/std.test.js index 2104cfdf3..93c54714a 100644 --- a/test/function/statistics/std.test.js +++ b/test/function/statistics/std.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), approx = require('../../../tools/approx'), - math = require('../../../index')(), + math = require('../../../index'), bignumber = math.bignumber, std = math.std; diff --git a/test/function/statistics/sum.test.js b/test/function/statistics/sum.test.js index b63223551..19bbacb8c 100644 --- a/test/function/statistics/sum.test.js +++ b/test/function/statistics/sum.test.js @@ -1,5 +1,5 @@ var assert = require('assert'), - math = require('../../../index')(), + math = require('../../../index'), bignumber = math.bignumber, sum = math.sum; diff --git a/test/function/statistics/var.test.js b/test/function/statistics/var.test.js index f51440cf6..dd6fc06d0 100644 --- a/test/function/statistics/var.test.js +++ b/test/function/statistics/var.test.js @@ -1,5 +1,5 @@ var assert = require('assert'), - math = require('../../../index')(), + math = require('../../../index'), bignumber = math.bignumber, variance = math['var']; diff --git a/test/function/trigonometry/acos.test.js b/test/function/trigonometry/acos.test.js index c9bfe1eac..1b82fa215 100644 --- a/test/function/trigonometry/acos.test.js +++ b/test/function/trigonometry/acos.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), approx = require('../../../tools/approx'), pi = math.pi, acos = math.acos, diff --git a/test/function/trigonometry/asin.test.js b/test/function/trigonometry/asin.test.js index 134934241..56053d9b9 100644 --- a/test/function/trigonometry/asin.test.js +++ b/test/function/trigonometry/asin.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), approx = require('../../../tools/approx'), pi = math.pi, complex = math.complex, diff --git a/test/function/trigonometry/atan.test.js b/test/function/trigonometry/atan.test.js index 61b21e742..a355fe9f8 100644 --- a/test/function/trigonometry/atan.test.js +++ b/test/function/trigonometry/atan.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), approx = require('../../../tools/approx'), pi = math.pi, complex = math.complex, diff --git a/test/function/trigonometry/atan2.test.js b/test/function/trigonometry/atan2.test.js index 8614535ad..9e40b1155 100644 --- a/test/function/trigonometry/atan2.test.js +++ b/test/function/trigonometry/atan2.test.js @@ -1,7 +1,7 @@ // test atan2 var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), approx = require('../../../tools/approx'), pi = math.pi, acos = math.acos, diff --git a/test/function/trigonometry/cos.test.js b/test/function/trigonometry/cos.test.js index 35a3b6c85..005fea32f 100644 --- a/test/function/trigonometry/cos.test.js +++ b/test/function/trigonometry/cos.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), approx = require('../../../tools/approx'), pi = math.pi, complex = math.complex, diff --git a/test/function/trigonometry/cosh.test.js b/test/function/trigonometry/cosh.test.js index fc9e800d7..e365218f7 100644 --- a/test/function/trigonometry/cosh.test.js +++ b/test/function/trigonometry/cosh.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), approx = require('../../../tools/approx'), pi = math.pi, complex = math.complex, diff --git a/test/function/trigonometry/cot.test.js b/test/function/trigonometry/cot.test.js index 5bfbbf255..9007e53ac 100644 --- a/test/function/trigonometry/cot.test.js +++ b/test/function/trigonometry/cot.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), approx = require('../../../tools/approx'), pi = math.pi, complex = math.complex, diff --git a/test/function/trigonometry/coth.test.js b/test/function/trigonometry/coth.test.js index c65676543..4227579d2 100644 --- a/test/function/trigonometry/coth.test.js +++ b/test/function/trigonometry/coth.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), approx = require('../../../tools/approx'), pi = math.pi, complex = math.complex, diff --git a/test/function/trigonometry/csc.test.js b/test/function/trigonometry/csc.test.js index ea57ac987..bdcd4a756 100644 --- a/test/function/trigonometry/csc.test.js +++ b/test/function/trigonometry/csc.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), approx = require('../../../tools/approx'), pi = math.pi, complex = math.complex, diff --git a/test/function/trigonometry/csch.test.js b/test/function/trigonometry/csch.test.js index 58548eb4d..b9bd20d73 100644 --- a/test/function/trigonometry/csch.test.js +++ b/test/function/trigonometry/csch.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), approx = require('../../../tools/approx'), pi = math.pi, complex = math.complex, diff --git a/test/function/trigonometry/sec.test.js b/test/function/trigonometry/sec.test.js index ac36aa4e0..066134daa 100644 --- a/test/function/trigonometry/sec.test.js +++ b/test/function/trigonometry/sec.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), approx = require('../../../tools/approx'), pi = math.pi, complex = math.complex, diff --git a/test/function/trigonometry/sech.test.js b/test/function/trigonometry/sech.test.js index 2e76c0df5..62f9ed033 100644 --- a/test/function/trigonometry/sech.test.js +++ b/test/function/trigonometry/sech.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), approx = require('../../../tools/approx'), pi = math.pi, complex = math.complex, diff --git a/test/function/trigonometry/sin.test.js b/test/function/trigonometry/sin.test.js index 59cf74b18..5b02cdfed 100644 --- a/test/function/trigonometry/sin.test.js +++ b/test/function/trigonometry/sin.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), approx = require('../../../tools/approx'), pi = math.pi, complex = math.complex, diff --git a/test/function/trigonometry/sinh.test.js b/test/function/trigonometry/sinh.test.js index cd15f420e..c85d2ed75 100644 --- a/test/function/trigonometry/sinh.test.js +++ b/test/function/trigonometry/sinh.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), approx = require('../../../tools/approx'), pi = math.pi, complex = math.complex, diff --git a/test/function/trigonometry/tan.test.js b/test/function/trigonometry/tan.test.js index d440c98e0..d645b3d4c 100644 --- a/test/function/trigonometry/tan.test.js +++ b/test/function/trigonometry/tan.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), approx = require('../../../tools/approx'), pi = math.pi, complex = math.complex, diff --git a/test/function/trigonometry/tanh.test.js b/test/function/trigonometry/tanh.test.js index 710305395..2d5ab9a27 100644 --- a/test/function/trigonometry/tanh.test.js +++ b/test/function/trigonometry/tanh.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(), + math = require('../../../index'), approx = require('../../../tools/approx'), pi = math.pi, complex = math.complex, diff --git a/test/function/units/to.test.js b/test/function/units/to.test.js index 8b7a02063..bd9b3ad2a 100644 --- a/test/function/units/to.test.js +++ b/test/function/units/to.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), approx = require('../../../tools/approx'), - math = require('../../../index')(), + math = require('../../../index'), Unit = require('../../../lib/type/Unit'), Matrix = require('../../../lib/type/Matrix'), unit = math.unit; diff --git a/test/function/utils/clone.test.js b/test/function/utils/clone.test.js index b9eba1037..744ae7de3 100644 --- a/test/function/utils/clone.test.js +++ b/test/function/utils/clone.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(); + math = require('../../../index'); describe('clone', function() { diff --git a/test/function/utils/forEach.test.js b/test/function/utils/forEach.test.js index 045992ef4..7e287365f 100644 --- a/test/function/utils/forEach.test.js +++ b/test/function/utils/forEach.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(); + math = require('../../../index'); describe('forEach', function() { diff --git a/test/function/utils/format.test.js b/test/function/utils/format.test.js index c47403bd6..3e3da58e3 100644 --- a/test/function/utils/format.test.js +++ b/test/function/utils/format.test.js @@ -61,7 +61,7 @@ describe('format', function() { }); describe('bignumber', function () { - var bigmath = math({precision: 20}); // ensure the precision is 20 digits + var bigmath = math.create({precision: 20}); // ensure the precision is 20 digits it('should format big numbers', function() { assert.equal(math.format(bigmath.bignumber(2).dividedBy(7)), '0.28571428571428571429'); diff --git a/test/function/utils/import.test.js b/test/function/utils/import.test.js index 28e605982..a173d0449 100644 --- a/test/function/utils/import.test.js +++ b/test/function/utils/import.test.js @@ -8,7 +8,7 @@ describe('import', function() { var math = null; beforeEach(function() { - math = mathjs(); + math = mathjs.create(); math.import({ myvalue: 42, hello: function (name) { diff --git a/test/function/utils/map.test.js b/test/function/utils/map.test.js index f0bb319f2..82cf7ad3e 100644 --- a/test/function/utils/map.test.js +++ b/test/function/utils/map.test.js @@ -1,6 +1,6 @@ var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(); + math = require('../../../index'); describe('map', function() { diff --git a/test/function/utils/print.test.js b/test/function/utils/print.test.js index 8a5640c70..73369ceb6 100644 --- a/test/function/utils/print.test.js +++ b/test/function/utils/print.test.js @@ -1,7 +1,7 @@ // test print var assert = require('assert'), error = require('../../../lib/error/index'), - math = require('../../../index')(); + math = require('../../../index'); describe('print', function() { diff --git a/test/function/utils/typeof.test.js b/test/function/utils/typeof.test.js index fe5f5a32b..8cc55f782 100644 --- a/test/function/utils/typeof.test.js +++ b/test/function/utils/typeof.test.js @@ -7,7 +7,7 @@ var assert = require('assert'), Help = require('../../../lib/type/Help'), Unit = require('../../../lib/type/Unit'), Complex = require('../../../lib/type/Complex'), - math = require('../../../index')(); + math = require('../../../index'); describe('typeof', function() { diff --git a/test/math.test.js b/test/math.test.js index 4cecdfac3..d63202adb 100644 --- a/test/math.test.js +++ b/test/math.test.js @@ -5,7 +5,7 @@ var assert = require('assert'), describe('factory', function() { it('should get a default instance of mathjs', function() { - assert.strictEqual(typeof math, 'function'); + assert.strictEqual(typeof math, 'object'); assert.deepEqual(math.config(), { matrix: 'matrix', number: 'number', @@ -15,12 +15,12 @@ describe('factory', function() { }); it('should create an instance of math.js with custom configuration', function() { - var math1 = math({ + var math1 = math.create({ matrix: 'array', number: 'bignumber' }); - assert.strictEqual(typeof math1, 'function'); + assert.strictEqual(typeof math1, 'object'); assert.deepEqual(math1.config(), { matrix: 'array', number: 'bignumber', @@ -30,8 +30,8 @@ describe('factory', function() { }); it('two instances of math.js should be isolated from each other', function() { - var math1 = math(); - var math2 = math({ + var math1 = math.create(); + var math2 = math.create({ matrix: 'array' }); @@ -54,7 +54,7 @@ describe('factory', function() { }); it('should apply configuration using the config function', function() { - var math1 = math(); + var math1 = math.create(); var config = math1.config(); assert.deepEqual(config, { @@ -89,7 +89,7 @@ describe('factory', function() { Object.create = undefined; // fake missing Object.create function assert.throws(function () { - var math1 = math(); + var math1 = math.create(); }, /ES5 not supported/); // restore Object.create diff --git a/test/type/Help.test.js b/test/type/Help.test.js index 10470ecce..9c381a3e5 100644 --- a/test/type/Help.test.js +++ b/test/type/Help.test.js @@ -1,7 +1,7 @@ // test Help var assert = require('assert'), Help = require('../../lib/type/Help'), - math = require('../../index')(); + math = require('../../index'); describe('help', function() { var doc = { diff --git a/test/type/Matrix.test.js b/test/type/Matrix.test.js index a23a327e8..08502770e 100644 --- a/test/type/Matrix.test.js +++ b/test/type/Matrix.test.js @@ -1,5 +1,5 @@ var assert = require('assert'), - math = require('../../index')(), + math = require('../../index'), index = math.index, Matrix = require('../../lib/type/Matrix'); diff --git a/test/type/Range.test.js b/test/type/Range.test.js index 0d3b78971..17a3fbaa3 100644 --- a/test/type/Range.test.js +++ b/test/type/Range.test.js @@ -1,7 +1,7 @@ // test data type Range var assert = require('assert'), - math = require('../../index')(), + math = require('../../index'), Range = math.type.Range; describe('range', function() {