1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
|
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8' />
<title>Testing decimal.js</title>
<style>
body {font-family: monospace; font-size: 12px; line-height: 14px;}
</style>
<script src='../decimal.js'></script>
<script src='./setup.js'></script>
</head>
<body>
<script>
var arr,
head = document.getElementsByTagName("head")[0],
i = 0,
passed = 0,
total = 0,
time = new Date(),
modules = [
'abs',
'acos',
'acosh',
'asin',
'asinh',
'atan',
'atan2',
'atanh',
'cbrt',
'ceil',
'clamp',
'clone',
'cmp',
'config',
'cos',
'cosh',
'Decimal',
'div',
'divToInt',
'dpSd',
'exp',
'floor',
'hypot',
'immutability',
'intPow',
'isFiniteEtc',
'ln',
'log',
'log10',
'log2',
'minAndMax',
'minus',
'mod',
'neg',
'plus',
'pow',
'random',
'round',
'sign',
'sin',
'sinh',
'sqrt',
'sum',
'tan',
'tanh',
'times',
'toBinary',
'toDP',
'toExponential',
'toFixed',
'toFraction',
'toHex',
'toNearest',
'toNumber',
'toOctal',
'toPrecision',
'toSD',
'toString',
'trunc',
'valueOf',
];
function load() {
var module = modules[i++];
if (!module) {
time = new Date() - time;
document.body.innerHTML +=
'<br> In total, ' + passed + ' of ' + total + ' tests passed in ' +
(time / 1e3) + ' secs.<br>';
document.body.scrollIntoView(false);
return;
}
var script = document.createElement("script");
script.src = './modules/' + module + '.js';
script.onload = script.onreadystatechange = function () {
if (!script.readyState || /loaded|complete/.test(script.readyState)) {
if (T.result) {
passed += T.result[0];
total += T.result[1];
}
head.removeChild(script);
count = script = null;
document.body.scrollIntoView(false);
setTimeout(load, 0);
}
};
head.appendChild(script);
}
document.body.innerHTML += ' Testing decimal.js<br><br>';
load();
</script>
</body>
</html>
|