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.
81 lines
1.8 KiB
81 lines
1.8 KiB
<!DOCTYPE html>
|
|
<html lang='en'>
|
|
<head>
|
|
<meta charset='utf-8' />
|
|
<title>Testing bignumber.js</title>
|
|
<style> body {font-family: monospace; font-size: 12px; line-height: 14px;}</style>
|
|
<script src='../bignumber.js'></script>
|
|
<script src='./tester.js'></script>
|
|
</head>
|
|
<body>
|
|
<script>
|
|
var arr,
|
|
head = document.getElementsByTagName("head")[0],
|
|
i = 0,
|
|
passed = 0,
|
|
total = 0,
|
|
time = new Date(),
|
|
methods = [
|
|
'absoluteValue',
|
|
'BigNumber',
|
|
'comparedTo',
|
|
'clone',
|
|
'config',
|
|
'dividedBy',
|
|
'dividedToIntegerBy',
|
|
'decimalPlaces',
|
|
'exponentiatedBy',
|
|
'integerValue',
|
|
'isBigNumber',
|
|
'minmax',
|
|
'minus',
|
|
'modulo',
|
|
'multipliedBy',
|
|
'negated',
|
|
'isMethods',
|
|
'plus',
|
|
'precision',
|
|
'random',
|
|
'shiftedBy',
|
|
'squareRoot',
|
|
'toExponential',
|
|
'toFixed',
|
|
'toFormat',
|
|
'toFraction',
|
|
'toNumber',
|
|
'toPrecision',
|
|
'toString'
|
|
];
|
|
|
|
function load() {
|
|
var method = methods[i++];
|
|
if (!method) {
|
|
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 = './methods/' + method + '.js';
|
|
script.onload = script.onreadystatechange = function () {
|
|
if (!script.readyState || /loaded|complete/.test(script.readyState)) {
|
|
if (Test.result) {
|
|
passed += Test.result[0];
|
|
total += Test.result[1];
|
|
}
|
|
head.removeChild(script);
|
|
count = script = null;
|
|
document.body.scrollIntoView(false);
|
|
setTimeout(load, 0);
|
|
}
|
|
};
|
|
head.appendChild(script);
|
|
}
|
|
|
|
document.body.innerHTML += ' Testing bignumber.js<br><br>';
|
|
load();
|
|
</script>
|
|
</body>
|
|
</html>
|