1023dd3b8Sopenharmony_ciif (typeof T === 'undefined') require('../setup'); 2023dd3b8Sopenharmony_ci 3023dd3b8Sopenharmony_ciT('min and max', function () { 4023dd3b8Sopenharmony_ci 5023dd3b8Sopenharmony_ci function t(min, max, arr) { 6023dd3b8Sopenharmony_ci T.assertEqual(new Decimal(max).valueOf(), Decimal.max.apply(Decimal, arr).valueOf()); 7023dd3b8Sopenharmony_ci T.assertEqual(new Decimal(min).valueOf(), Decimal.min.apply(Decimal, arr).valueOf()); 8023dd3b8Sopenharmony_ci } 9023dd3b8Sopenharmony_ci 10023dd3b8Sopenharmony_ci Decimal.config({ 11023dd3b8Sopenharmony_ci precision: 20, 12023dd3b8Sopenharmony_ci rounding: 4, 13023dd3b8Sopenharmony_ci toExpNeg: -7, 14023dd3b8Sopenharmony_ci toExpPos: 21, 15023dd3b8Sopenharmony_ci minE: -9e15, 16023dd3b8Sopenharmony_ci maxE: 9e15 17023dd3b8Sopenharmony_ci }); 18023dd3b8Sopenharmony_ci 19023dd3b8Sopenharmony_ci t(NaN, NaN, [NaN]); 20023dd3b8Sopenharmony_ci t(NaN, NaN, [-2, 0, -1, NaN]); 21023dd3b8Sopenharmony_ci t(NaN, NaN, [-2, NaN, 0, -1]); 22023dd3b8Sopenharmony_ci t(NaN, NaN, [NaN, -2, 0, -1]); 23023dd3b8Sopenharmony_ci t(NaN, NaN, [NaN, -2, 0, -1]); 24023dd3b8Sopenharmony_ci t(NaN, NaN, [-2, 0, -1, new Decimal(NaN)]); 25023dd3b8Sopenharmony_ci t(NaN, NaN, [-2, 0, -1, new Decimal(NaN)]); 26023dd3b8Sopenharmony_ci t(NaN, NaN, [Infinity, -2, 'NaN', 0, -1, -Infinity]); 27023dd3b8Sopenharmony_ci t(NaN, NaN, ['NaN', Infinity, -2, 0, -1, -Infinity]); 28023dd3b8Sopenharmony_ci t(NaN, NaN, [Infinity, -2, NaN, 0, -1, -Infinity]); 29023dd3b8Sopenharmony_ci 30023dd3b8Sopenharmony_ci t(0, 0, [0, 0, 0]); 31023dd3b8Sopenharmony_ci t(-2, Infinity, [-2, 0, -1, Infinity]); 32023dd3b8Sopenharmony_ci t(-Infinity, 0, [-2, 0, -1, -Infinity]); 33023dd3b8Sopenharmony_ci t(-Infinity, Infinity, [-Infinity, -2, 0, -1, Infinity]); 34023dd3b8Sopenharmony_ci t(-Infinity, Infinity, [Infinity, -2, 0, -1, -Infinity]); 35023dd3b8Sopenharmony_ci t(-Infinity, Infinity, [-Infinity, -2, 0, new Decimal(Infinity)]); 36023dd3b8Sopenharmony_ci 37023dd3b8Sopenharmony_ci t(-2, 0, [-2, 0, -1]); 38023dd3b8Sopenharmony_ci t(-2, 0, [-2, -1, 0]); 39023dd3b8Sopenharmony_ci t(-2, 0, [0, -2, -1]); 40023dd3b8Sopenharmony_ci t(-2, 0, [0, -1, -2]); 41023dd3b8Sopenharmony_ci t(-2, 0, [-1, -2, 0]); 42023dd3b8Sopenharmony_ci t(-2, 0, [-1, 0, -2]); 43023dd3b8Sopenharmony_ci 44023dd3b8Sopenharmony_ci t(-1, 1, [-1, 0, 1]); 45023dd3b8Sopenharmony_ci t(-1, 1, [-1, 1, 0]); 46023dd3b8Sopenharmony_ci t(-1, 1, [0, -1, 1]); 47023dd3b8Sopenharmony_ci t(-1, 1, [0, 1, -1]); 48023dd3b8Sopenharmony_ci t(-1, 1, [1, -1, 0]); 49023dd3b8Sopenharmony_ci t(-1, 1, [1, 0, -1]); 50023dd3b8Sopenharmony_ci 51023dd3b8Sopenharmony_ci t(0, 2, [0, 1, 2]); 52023dd3b8Sopenharmony_ci t(0, 2, [0, 2, 1]); 53023dd3b8Sopenharmony_ci t(0, 2, [1, 0, 2]); 54023dd3b8Sopenharmony_ci t(0, 2, [1, 2, 0]); 55023dd3b8Sopenharmony_ci t(0, 2, [2, 1, 0]); 56023dd3b8Sopenharmony_ci t(0, 2, [2, 0, 1]); 57023dd3b8Sopenharmony_ci 58023dd3b8Sopenharmony_ci t(-1, 1, ['-1', 0, new Decimal(1)]); 59023dd3b8Sopenharmony_ci t(-1, 1, ['-1', new Decimal(1)]); 60023dd3b8Sopenharmony_ci t(-1, 1, [0, '-1', new Decimal(1)]); 61023dd3b8Sopenharmony_ci t(0, 1, [0, new Decimal(1)]); 62023dd3b8Sopenharmony_ci t(1, 1, [new Decimal(1)]); 63023dd3b8Sopenharmony_ci t(-1, -1, [new Decimal(-1)]); 64023dd3b8Sopenharmony_ci 65023dd3b8Sopenharmony_ci t(0.0009999, 0.0010001, [0.001, 0.0009999, 0.0010001]); 66023dd3b8Sopenharmony_ci t(-0.0010001, -0.0009999, [-0.001, -0.0009999, -0.0010001]); 67023dd3b8Sopenharmony_ci t(-0.000001, 999.001, [2, -0, '1e-9000000000000000', 324.32423423, -0.000001, '999.001', 10]); 68023dd3b8Sopenharmony_ci t('-9.99999e+9000000000000000', Infinity, [10, '-9.99999e+9000000000000000', new Decimal(Infinity), '9.99999e+9000000000000000', 0]); 69023dd3b8Sopenharmony_ci t('-9.999999e+9000000000000000', '1.01e+9000000000000000', ['-9.99998e+9000000000000000', '-9.999999e+9000000000000000', '9e+8999999999999999', '1.01e+9000000000000000', 1e+300]); 70023dd3b8Sopenharmony_ci t(1, Infinity, [1, '1e+9000000000000001', 1e200]); 71023dd3b8Sopenharmony_ci t(-Infinity, 1, [1, '-1e+9000000000000001', -1e200]); 72023dd3b8Sopenharmony_ci t(0, 1, [1, '1e-9000000000000001', 1e-200]); 73023dd3b8Sopenharmony_ci t(-0, 1, [1, '-1e-9000000000000001', 1e-200]); 74023dd3b8Sopenharmony_ci t(-3, 3, [1, '2', 3, '-1', -2, '-3']); 75023dd3b8Sopenharmony_ci}); 76