mirror of
https://github.com/MikeMcl/decimal.js.git
synced 2024-10-27 20:34:12 +00:00
117 lines
2.5 KiB
HTML
117 lines
2.5 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;}
|
|
.pass { color: black; background-color: white }
|
|
.fail { color: black; background-color: white }
|
|
</style>
|
|
<script src='../decimal.js'></script>
|
|
<script src='./setup.js'></script>
|
|
</head>
|
|
<body>
|
|
<script>
|
|
var arr,
|
|
i = 0,
|
|
passed = 0,
|
|
total = 0,
|
|
start = +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',
|
|
'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',
|
|
'toJSON',
|
|
'toNearest',
|
|
'toNumber',
|
|
'toOctal',
|
|
'toPrecision',
|
|
'toSD',
|
|
'toString',
|
|
'trunc',
|
|
'valueOf',
|
|
];
|
|
|
|
function load() {
|
|
var head = document.getElementsByTagName("head")[0],
|
|
script = document.createElement("script");
|
|
script.src = './modules/' + modules[i] + '.js';
|
|
if (!modules[i++]) {
|
|
document.body.innerHTML += '<br>In total, ' + passed + ' of ' + total +
|
|
' tests passed in ' + ((+new Date() - start) / 1000) + ' secs.<br>';
|
|
document.body.scrollIntoView(false);
|
|
return;
|
|
}
|
|
script.onload = script.onreadystatechange = function () {
|
|
if (!script.readyState || /loaded|complete/.test(script.readyState)) {
|
|
if (!T.result) {
|
|
document.body.innerHTML +=
|
|
'<br><span style="color: red">Test script failed - see error console.</span>';
|
|
} else {
|
|
passed += T.result[0];
|
|
total += T.result[1];
|
|
}
|
|
head.removeChild(script);
|
|
count = script = null;
|
|
//document.body.innerHTML += '<br>';
|
|
document.body.scrollIntoView(false);
|
|
setTimeout(load, 0);
|
|
}
|
|
|
|
};
|
|
head.appendChild(script);
|
|
}
|
|
|
|
document.body.innerHTML += 'Testing decimal.js<br>';
|
|
load();
|
|
</script>
|
|
</body>
|
|
</html>
|