mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-18 14:59:29 +00:00
Fix of bug fixes in `rationalize.js`, also changing `simplify.js` and `simplifyConstant.js` and more 2 bugs in `simplify.js` and `simplifyconstant.js` in order to be possible passing in `Travis` test. **Bugs in `simplifyConstant.js` and `simplify.js`** 1. `simplifyConstant.js` - I've changed `new ConstantNode(stringNumber, 'number')` to `new ConstantNode(number)` 1. `simplify.js` - Due to problems with a number node with string type, I've added `!isNaN(node.value)))` in number type test condition **Bugs in `rationalize.js`** 3. I've fixed negative power exponents and decimals coefficients troubles. The decimals coefficients problem has led to the need to add a new feature in `simplify.js ` and `simplifyConstant.js` (next topic) **New feature in `simplify.js` and `simplifyConstant.js`** 4. New rule type (string), whose valid values are in `listCommStrings` new variable. The only string rule accepted so far is to turn off exact fraction conversion in `simplifyConstant.js`
Tests
To execute the tests, install mocha and run the following in the root of
the project:
npm install -g mocha
mocha test --recursive
It's important to run mocha with the --recursive flag, as most tests are
located in nested folders.
Code coverage
To test code coverage of the tests, install istanbul and run it:
npm install -g istanbul
istanbul cover _mocha -- test --recursive
Note the underscore before mocha, and the -- surrounded by spaces after _mocha.
See also https://github.com/gotwarlost/istanbul/issues/44.
To see the results, open the generated report in your browser:
./coverage/lcov-report/index.html