From 2ba2d245c152cdbb26f918bc4481c77b8004f3cd Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 9 Jan 2014 16:48:56 +0100 Subject: 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 --- tests/manual/v4/sparsearraytest.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/manual/v4/sparsearraytest.js (limited to 'tests/manual') 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" + } + } + } +} -- cgit v1.2.3