Remove ArrayFuzzer from observe.sky test (was timing out).

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/695413003
This commit is contained in:
Rafael Weinstein 2014-11-03 12:49:41 -08:00
parent ab8e1f98d5
commit 3eb5be249e
2 changed files with 4 additions and 138 deletions

View File

@ -2,7 +2,7 @@ ERROR: Exception caught during observer callback: ouch
SOURCE: http://127.0.0.1:8000/sky/framework/sky-element/observe.sky:627
ERROR: Exception caught during observer callback: ouch
SOURCE: http://127.0.0.1:8000/sky/framework/sky-element/observe.sky:627
Running 80 tests
Running 79 tests
ok 1 Path constructor throws
ok 2 Path path validity
ok 3 Path Paths are interned
@ -81,8 +81,7 @@ ok 75 ArrayObserver Tests Array Tracker Delete Mid Array
ok 76 ArrayObserver Tests Array Random Case 1
ok 77 ArrayObserver Tests Array Random Case 2
ok 78 ArrayObserver Tests Array Random Case 3
ok 79 ArrayObserver Tests Array Tracker Fuzzer
ok 80 ArrayObserver Tests Array Tracker No Proxies Edits
80 tests
80 pass
ok 79 ArrayObserver Tests Array Tracker No Proxies Edits
79 tests
79 pass
0 fail

View File

@ -1710,139 +1710,6 @@ describe('ArrayObserver Tests', function() {
applySplicesAndAssertDeepEqual(model, copy);
});
function ArrayFuzzer() {}
ArrayFuzzer.valMax = 16;
ArrayFuzzer.arrayLengthMax = 128;
ArrayFuzzer.operationCount = 64;
function randDouble(start, end) {
return Math.random()*(end-start) + start;
}
function randInt(start, end) {
return Math.round(randDouble(start, end));
}
function randASCIIChar() {
return String.fromCharCode(randInt(32, 126));
}
function randValue() {
switch(randInt(0, 5)) {
case 0:
return {};
case 1:
return undefined;
case 2:
return null;
case 3:
return randInt(0, ArrayFuzzer.valMax);
case 4:
return randDouble(0, ArrayFuzzer.valMax);
case 5:
return randASCIIChar();
}
}
function randArray() {
var args = [];
var count = randInt(0, ArrayFuzzer.arrayLengthMax);
while(count-- > 0)
args.push(randValue());
return args;
}
function randomArrayOperation(arr) {
function empty() {
return [];
}
var operations = {
push: randArray,
unshift: randArray,
pop: empty,
shift: empty,
splice: function() {
var args = [];
args.push(randInt(-arr.length*2, arr.length*2), randInt(0, arr.length*2));
args = args.concat(randArray());
return args;
}
};
// Do a splice once for each of the other operations.
var operationList = ['splice', 'update',
'splice', 'delete',
'splice', 'push',
'splice', 'pop',
'splice', 'shift',
'splice', 'unshift'];
var op = {
name: operationList[randInt(0, operationList.length - 1)]
};
switch(op.name) {
case 'delete':
op.index = randInt(0, arr.length - 1);
delete arr[op.index];
break;
case 'update':
op.index = randInt(0, arr.length);
op.value = randValue();
arr[op.index] = op.value;
break;
default:
op.args = operations[op.name]();
arr[op.name].apply(arr, op.args);
break;
}
return op;
}
function randomArrayOperations(arr, count) {
var ops = []
for (var i = 0; i < count; i++) {
ops.push(randomArrayOperation(arr));
}
return ops;
}
ArrayFuzzer.prototype.go = function() {
var orig = this.arr = randArray();
randomArrayOperations(this.arr, ArrayFuzzer.operationCount);
var copy = this.copy = this.arr.slice();
this.origCopy = this.copy.slice();
var observer = new ArrayObserver(this.arr);
observer.open(function(splices) {
ArrayObserver.applySplices(copy, orig, splices);
});
this.ops = randomArrayOperations(this.arr, ArrayFuzzer.operationCount);
observer.deliver();
observer.close();
}
it('Array Tracker Fuzzer', function() {
var testCount = 64;
for (var i = 0; i < testCount; i++) {
var fuzzer = new ArrayFuzzer();
fuzzer.go();
ensureNonSparse(fuzzer.arr);
ensureNonSparse(fuzzer.copy);
assert.deepEqual(fuzzer.arr, fuzzer.copy);
}
});
it('Array Tracker No Proxies Edits', function() {
var model = [];
observer = new ArrayObserver(model);