| function shouldBe(actual, expected) { |
| throw new Error('bad value: ' + actual); |
| var array = [1, 2, 3, 4]; |
| ensureArrayStorage(array); |
| for (var i = 0; i < 1e5; ++i) |
| shouldBe(test1(array), true); |
| ensureArrayStorage(array); |
| shouldBe(test1(array), false); |
| ensureArrayStorage(array); |
| shouldBe(test1(array), false); |
| var array1 = [1, 2, 3, 4]; |
| ensureArrayStorage(array1); |
| ensureArrayStorage(array2); |
| for (var i = 0; i < 1e5; ++i) |
| shouldBe(test2(array2), false); |
| shouldBe(test2(array2), false); |
| shouldBe(test2(array1), true); |