1
0
mirror of https://github.com/MikeMcl/decimal.js.git synced 2026-09-22 20:04:09 +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.sin().valueOf());
T.assertEqual(expected, Decimal.sin(n).valueOf());
T.assertEqual(expected, new Decimal(n).sin().valueOf());
T.assert(x.eq(n) || x.isNaN());
}
Decimal.config({
@@ -28,6 +30,9 @@ if (typeof T === 'undefined') require('../setup');
t('93332358216', 48, 5, '0.000816283943127306029649893248669685836695194145277');
t('766737078569022420173292205068953186848344673451240027655054631094318050', 18, 6, '0.00111135055272494455');
t('-93332358216', 48, 5, '-0.000816283943127306029649893248669685836695194145277');
t('-766737078569022420173292205068953186848344673451240027655054631094318050', 18, 6, '-0.00111135055272494455');
t('0.359136383962093189473162700700590970518456985109181875257764726415814563424613193774806585890478208084275468196568294033', 38, 1, '0.35146584650000000000000000000000000006');
t('3202222222227222222222222222222224222222222222222222222222.222222222222222222222222222', 7, 0, '0.5499568');
t('8', 5, 6, '0.98936');