test.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. var time = process.hrtime(),
  2. passed = 0,
  3. total = 0;
  4. console.log('\n Testing bignumber.js\n');
  5. [
  6. 'absoluteValue',
  7. 'BigNumber',
  8. 'comparedTo',
  9. 'clone',
  10. 'config',
  11. 'dividedBy',
  12. 'dividedToIntegerBy',
  13. 'decimalPlaces',
  14. 'exponentiatedBy',
  15. 'integerValue',
  16. 'isBigNumber',
  17. 'minmax',
  18. 'minus',
  19. 'modulo',
  20. 'multipliedBy',
  21. 'negated',
  22. 'isMethods',
  23. 'plus',
  24. 'precision',
  25. 'random',
  26. 'shiftedBy',
  27. 'squareRoot',
  28. 'sum',
  29. 'toExponential',
  30. 'toFixed',
  31. 'toFormat',
  32. 'toFraction',
  33. 'toNumber',
  34. 'toPrecision',
  35. 'toString'
  36. ]
  37. .forEach(function (method) {
  38. require('./methods/' + method);
  39. passed += Test.result[0];
  40. total += Test.result[1];
  41. // Reset BigNumber for each method tested?
  42. //delete require.cache[require.resolve('../bignumber.js')];
  43. //BigNumber = require('../bignumber');
  44. //BigNumber.DEBUG = true;
  45. });
  46. time = process.hrtime(time);
  47. time = time[0] * 1e3 + (time[1] / 1e6 | 0);
  48. console.log('\n In total, ' + passed + ' of ' + total + ' tests passed in ' + time + ' ms \n');