every-test.html
1 <!DOCTYPE html> 2 <html lang='en'> 3 <head> 4 <meta charset='utf-8' /> 5 <title>Testing bignumber.js</title> 6 <style> body {font-family: monospace; font-size: 12px; line-height: 14px;}</style> 7 <script src='../../bignumber.js'></script> 8 </head> 9 <body> 10 <script> 11 var arr, 12 passed = 0, 13 total = 0, 14 i = 0, 15 start = +new Date(), 16 methods = [ 17 'abs', 18 'base-in', 19 'base-out', 20 'ceil', 21 'cmp', 22 'config', 23 'div', 24 'divToInt', 25 'dp', 26 'floor', 27 'minmax', 28 'minus', 29 'mod', 30 'neg', 31 'others', 32 'plus', 33 'pow', 34 'random', 35 'round', 36 'sd', 37 'shift', 38 'sqrt', 39 'times', 40 'toDigits', 41 'toExponential', 42 'toFixed', 43 'toFormat', 44 'toFraction', 45 'toNumber', 46 'toPrecision', 47 'toString', 48 'trunc' 49 ]; 50 51 function load() { 52 var head = document.getElementsByTagName("head")[0], 53 script = document.createElement("script"); 54 script.src = '../' + methods[i] + '.js'; 55 if (!methods[i++]) { 56 document.body.innerHTML += '<br>IN TOTAL: ' + passed + ' of ' + total + 57 ' tests passed in ' + ( (+new Date() - start) / 1000 ) + ' secs.<br>'; 58 document.body.scrollIntoView(false); 59 return; 60 } 61 62 script.onload = script.onreadystatechange = function () { 63 if (!script.readyState || /loaded|complete/.test(script.readyState)) { 64 if (!count) { 65 document.body.innerHTML += 66 '<br><span style="color: red">TEST SCRIPT FAILED - see error console.</span>'; 67 } else { 68 passed += count[0]; 69 total += count[1]; 70 } 71 head.removeChild(script); 72 count = script = null; 73 document.body.innerHTML += '<br>'; 74 document.body.scrollIntoView(false); 75 setTimeout(load, 0); 76 } 77 }; 78 head.appendChild(script); 79 } 80 document.body.innerHTML += 'BIGNUMBER TESTING<br>'; 81 load(); 82 </script> 83 </body> 84 </html>