mirror of
https://github.com/MikeMcl/decimal.js.git
synced 2024-10-27 20:34:12 +00:00
113 lines
2.1 KiB
HTML
113 lines
2.1 KiB
HTML
<!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',
|
|
'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',
|
|
'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>
|