mirror of
https://github.com/MikeMcl/decimal.js.git
synced 2024-10-27 20:34:12 +00:00
b141f3480d
Avoid potential confusion over the round method: ceil, floor, round and trunc no longer accept arguments and so they match their JS Math object equivalents. Removed toInteger as round now handles rounding to integer. Added toSignificantDigits as round no longer rounds to precision. Updated tests accordingly. Calling config without argument no longer throws.
103 lines
857 B
JavaScript
103 lines
857 B
JavaScript
var arr,
|
|
passed = 0,
|
|
total = 0,
|
|
start = +new Date();
|
|
|
|
console.log( '\n STARTING TESTS...\n' );
|
|
|
|
[
|
|
'abs',
|
|
'baseIn',
|
|
'baseOut',
|
|
'ceil',
|
|
'cmp',
|
|
'config',
|
|
'constructor',
|
|
'div',
|
|
'divToInt',
|
|
'dpSd',
|
|
'exp',
|
|
'floor',
|
|
'intPow',
|
|
'isFiniteEtc',
|
|
'ln',
|
|
'log',
|
|
'log10',
|
|
'minAndMax',
|
|
'minus',
|
|
'mod',
|
|
'neg',
|
|
'plus',
|
|
'pow',
|
|
'random',
|
|
'round',
|
|
'sqrt',
|
|
'times',
|
|
'toDP',
|
|
'toExponential',
|
|
'toFixed',
|
|
'toFormat',
|
|
'toFraction',
|
|
'toNearest',
|
|
'toNumber',
|
|
'toPrecision',
|
|
'toSD',
|
|
'toStringEtc',
|
|
'trunc'
|
|
]
|
|
.forEach( function (method) {
|
|
arr = require('./' + method);
|
|
passed += arr[0];
|
|
total += arr[1];
|
|
});
|
|
|
|
console.log( '\n IN TOTAL: ' + passed + ' of ' + total + ' tests passed in ' +
|
|
( (+new Date() - start) / 1000 ) + ' secs.\n' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|