diff options
author | Lars Knoll <[email protected]> | 2014-01-09 16:48:56 +0100 |
---|---|---|
committer | The Qt Project <[email protected]> | 2014-01-20 21:14:20 +0100 |
commit | 2ba2d245c152cdbb26f918bc4481c77b8004f3cd (patch) | |
tree | 19557bf1c50f9d702fcf2634885eff67ab2c01bc /tests/manual/v4/sparsearraytest.js | |
parent | 683a3e456e29ffa15c439ef66609e8b729140eb8 (diff) |
Fixes to sparse array handling
deleting entries in sparse arrays could lead
to rather unexpected results where values got
moved to wrong indices, as we didn't correctly
update the size_left values in the red-black tree.
Change-Id: If71fcc04d39f257194394cb4f734d0db14b92b69
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'tests/manual/v4/sparsearraytest.js')
-rw-r--r-- | tests/manual/v4/sparsearraytest.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/manual/v4/sparsearraytest.js b/tests/manual/v4/sparsearraytest.js new file mode 100644 index 0000000000..921a750472 --- /dev/null +++ b/tests/manual/v4/sparsearraytest.js @@ -0,0 +1,21 @@ +var max +for (max = 2; max < 100; ++max) { + var arr = []; + arr[10000000] = -1 + var i; + var j; + for (i = 0; i < max; ++i) + arr[i] = i; + for (i = 1; i < max; i += 2) { + delete arr[i]; + for (j = 0; j < max; ++j) { + if (j <= i && (j %2)) { + if (arr[j] != undefined) + throw "err1" + } else { + if (arr[j] != j) + throw "err2" + } + } + } +} |