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