MCPcopy Index your code
hub / github.com/nodejs/node / TestSparseInheritedElementSort

Function TestSparseInheritedElementSort

deps/v8/test/mjsunit/array-sort.js:229–257  ·  view source on GitHub ↗
(scale)

Source from the content-addressed store, hash-verified

227TestInheritedElementSort(15);
228
229function TestSparseInheritedElementSort(scale) {
230 var length = scale * 10;
231 var x = {length: length};
232 var y = {};
233 y.__proto__ = x;
234
235 for (var i = 0; i < 5; i++) {
236 x[i * 2 * scale] = 2 * (4 - i);
237 y[(i * 2 + 1) * scale] = 2 * (4 - i) + 1;
238 }
239
240 var name = "SparseSortInherit(" + scale + ")-";
241
242 Array.prototype.sort.call(y);
243
244 assertEquals(length, y.length, name +"length");
245
246 for (var i = 0; i < 10; i++) {
247 assertTrue(y.hasOwnProperty(i), name + "hasvalue" + i);
248 assertEquals(i, y[i], name + "value" + i);
249 }
250 for (var i = 10; i < length; i++) {
251 assertFalse(y.hasOwnProperty(i), name + "noundef" + i);
252
253 if (x.hasOwnProperty(i)) {
254 assertTrue(0 == i % (2 * scale), name + "new_x" + i);
255 }
256 }
257}
258
259TestSparseInheritedElementSort(10);
260TestSparseInheritedElementSort(100);

Callers 1

array-sort.jsFile · 0.85

Calls 5

assertTrueFunction · 0.70
assertEqualsFunction · 0.50
assertFalseFunction · 0.50
callMethod · 0.45
hasOwnPropertyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…