From 7e8279f245f671a2a356afbaa0bb5fa48838d8bc Mon Sep 17 00:00:00 2001 From: David Greenspan Date: Tue, 24 Apr 2012 09:28:16 -0700 Subject: [PATCH] shorter, random diff/patch fuzz test; clarify comments --- packages/liveui/liveui_tests.js | 7 +++++-- packages/mongo-livedata/mongo_livedata_tests.js | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/liveui/liveui_tests.js b/packages/liveui/liveui_tests.js index 7a0e6576e1..87a437a528 100644 --- a/packages/liveui/liveui_tests.js +++ b/packages/liveui/liveui_tests.js @@ -429,8 +429,11 @@ Tinytest.add("liveui - preserved nodes (diff/patch)", function(test) { return buf; }; - for(var i=0; i<20; i++) { - rand = new SeededRandom("preserved nodes "+i); + for(var i=0; i<5; i++) { + // Use non-deterministic randomness so we can have a shorter fuzz + // test (fewer iterations). For deterministic (fully seeded) + // randomness, remove the call to Math.random(). + rand = new SeededRandom("preserved nodes "+i+" "+Math.random()); var R = ReactiveVar(false); var structure = randomNodeList(null, 4); diff --git a/packages/mongo-livedata/mongo_livedata_tests.js b/packages/mongo-livedata/mongo_livedata_tests.js index 44ecce334b..f4eb4539f0 100644 --- a/packages/mongo-livedata/mongo_livedata_tests.js +++ b/packages/mongo-livedata/mongo_livedata_tests.js @@ -187,10 +187,11 @@ Tinytest.addAsync("mongo-livedata - fuzz test", function(test, onComplete) { var step = 0; - // Random integer in [0,n) - // use SeededRandom test helper to allow for deterministic results. - // comment out random input to use seeded mode + // Use non-deterministic randomness so we can have a shorter fuzz + // test (fewer iterations). For deterministic (fully seeded) + // randomness, remove the call to Math.random(). var seededRandom = new SeededRandom("foobard" + Math.random()); + // Random integer in [0,n) var rnd = function (n) { return seededRandom.nextIntBetween(0, n-1); };