You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
MikeMcl_decimal.js/test/test.html

115 lines
2.1 KiB

<!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>&nbsp;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 += '&nbsp;Testing decimal.js<br><br>';
load();
</script>
</body>
</html>