mirror of https://github.com/svaarala/duktape.git
Sami Vaarala
8 years ago
2 changed files with 56 additions and 0 deletions
@ -0,0 +1,26 @@ |
|||
/* |
|||
* Array sort() test |
|||
*/ |
|||
|
|||
if (typeof print !== 'function') { print = console.log; } |
|||
|
|||
function test() { |
|||
var arr = []; |
|||
var i, j; |
|||
var rnd = Math.random; |
|||
|
|||
for (i = 0; i < 5; i++) { |
|||
for (j = 0; j < 10000; j++) { |
|||
arr[j] = rnd(); |
|||
} |
|||
|
|||
arr.sort(); |
|||
} |
|||
} |
|||
|
|||
try { |
|||
test(); |
|||
} catch (e) { |
|||
print(e.stack || e); |
|||
throw e; |
|||
} |
@ -0,0 +1,30 @@ |
|||
/* |
|||
* Math.random() test |
|||
*/ |
|||
|
|||
if (typeof print !== 'function') { print = console.log; } |
|||
|
|||
function test() { |
|||
var i; |
|||
var rnd = Math.random; |
|||
|
|||
for (i = 0; i < 3e5; i++) { |
|||
rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); |
|||
rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); |
|||
rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); |
|||
rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); |
|||
rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); |
|||
rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); |
|||
rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); |
|||
rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); |
|||
rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); |
|||
rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); rnd(); |
|||
} |
|||
} |
|||
|
|||
try { |
|||
test(); |
|||
} catch (e) { |
|||
print(e.stack || e); |
|||
throw e; |
|||
} |
Loading…
Reference in new issue