summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/collections/Set-delete-size.js
blob: 524978b8178abc5fdbae8c6d4ff03ecc6597cb78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// set.delete(v) decrements set.size iff the set contained v.

var s = new Set();
for (var i = 0; i < 10; i++)
    s.add(i);

for (var i = 10; i > 0; i--) {
    assertEq(s.size, i);
    assertEq(s.delete(i), false);
    assertEq(s.size, i);
    assertEq(s.delete(i - 1), true);
    assertEq(s.size, i - 1);
    assertEq(s.delete(i - 1), false);
    assertEq(s.size, i - 1);
}