1
0
mirror of https://github.com/MikeMcl/decimal.js.git synced 2026-09-23 04:14:32 +00:00

refactor tests

This commit is contained in:
Michael Mclaughlin
2016-02-06 17:51:29 +00:00
parent 587b9fe82f
commit caad23d669
64 changed files with 308 additions and 549 deletions

View File

@@ -1,7 +1,6 @@
if (typeof T === 'undefined') require('../setup');
(function () {
T('toSignificantDigits');
T('toSignificantDigits', function () {
function t(expected, n, sd, rm) {
T.assertEqual(expected, new Decimal(n).toSD(sd, rm).valueOf());
@@ -369,7 +368,6 @@ if (typeof T === 'undefined') require('../setup');
t('54564000000000000000000000000000000000', '54563203006377285590954695127259934956.72304700', 5, 2);
t('937851991874226678.2', '937851991874226678.191965007088457', 19, 0);
t('9141378468539383564638997660000', '9141378468539383564638997666387.513564869223', 27, 1);
t('5140000000000000000000000', '5143738381911696659148152.2424402227698278853166', 3, 3);
t('20497199023806.45608949', '20497199023806.45608949227987004920339939', 22, 5);
t('81603182.7', '81603182.616632542195753770061305729184', 9, 2);
t('1288222268118280000000000000000000000000', '1288222268118271079758562419926059399472.4003871704903395624929468673346838726', 15, 2);
@@ -551,6 +549,4 @@ if (typeof T === 'undefined') require('../setup');
tx(function () {new Decimal('12.345').toSD('-1e-1')}, ".toSD('-1e-1')");
tx(function () {new Decimal('12.345').toSD(Infinity)}, ".toSD(Infinity)");
tx(function () {new Decimal('12.345').toSD('-Infinity')}, ".toSD('-Infinity')");
T.stop();
})();
});