aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Coleman <coleman.ian@gmail.com>2016-08-23 18:25:38 +1000
committerIan Coleman <coleman.ian@gmail.com>2016-08-23 18:25:38 +1000
commitfb3726873f9dd6d7319388a1a5e472042098248b (patch)
tree5c2133c7b08b88d16b27396366ddb02519a48aa3
parentd077e1e71643798614f66652509ca3a409e530a8 (diff)
downloadBIP39-fb3726873f9dd6d7319388a1a5e472042098248b.tar.gz
BIP39-fb3726873f9dd6d7319388a1a5e472042098248b.tar.zst
BIP39-fb3726873f9dd6d7319388a1a5e472042098248b.zip
Test order is randomized
-rw-r--r--tests.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests.js b/tests.js
index a04137f..bacaec0 100644
--- a/tests.js
+++ b/tests.js
@@ -56,6 +56,21 @@ function next() {
56 } 56 }
57} 57}
58 58
59/**
60 * Randomize array element order in-place.
61 * Using Durstenfeld shuffle algorithm.
62 * See http://stackoverflow.com/a/12646864
63 */
64function shuffle(array) {
65 for (var i = array.length - 1; i > 0; i--) {
66 var j = Math.floor(Math.random() * (i + 1));
67 var temp = array[i];
68 array[i] = array[j];
69 array[j] = temp;
70 }
71 return array;
72}
73
59tests = [ 74tests = [
60 75
61// Page loads with status of 'success' 76// Page loads with status of 'success'
@@ -602,4 +617,5 @@ page.open(url, function(status) {
602]; 617];
603 618
604console.log("Running tests..."); 619console.log("Running tests...");
620tests = shuffle(tests);
605next(); 621next();