1
0
mirror of https://github.com/MikeMcl/decimal.js.git synced 2026-09-23 12:24:47 +00:00

Mutation tests

This commit is contained in:
Jayson Harshbarger
2016-01-29 11:50:16 +09:00
parent b8b2ed7a2b
commit ec0955c28e
6 changed files with 24 additions and 10 deletions

View File

@@ -6,8 +6,10 @@ if (typeof T === 'undefined') require('../setup');
function t(n, pr, rm, expected) {
Decimal.precision = pr;
Decimal.rounding = rm;
var x = new Decimal(n);
T.assertEqual(expected, x.tan().valueOf());
T.assertEqual(expected, Decimal.tan(n).valueOf());
T.assertEqual(expected, new Decimal(n).tan().valueOf());
T.assert(x.eq(n) || x.isNaN());
}
Decimal.config({
@@ -26,8 +28,10 @@ if (typeof T === 'undefined') require('../setup');
t('-Infinity', 40, 4, 'NaN');
t('3', 5, 5, '-0.14255');
t('-3', 5, 5, '0.14255');
t('0.8', 7, 6, '1.029639');
t('539998661123466984649191689138494900416386817996524', 7, 6, '32.04695');
t('-539998661123466984649191689138494900416386817996524', 7, 6, '-32.04695');
t('0.5172293543584894071801901902', 5, 1, '0.56888');
t('5', 10, 5, '-3.380515006');
t('0.5283979979897015', 1, 4, '0.6');