Closed
Description
What happened
Incorrect subtract
result when Set
contains 32+ elements and subtracted elements is n/2+1
How to reproduce
Check 2 cases when capacity
is less than 32 and equal or more than 32
const { OrderedSet } = require('immutable@4.0.0-rc.12');
const capacity = 32;
const allItems = OrderedSet(Array(capacity).fill(1).map((el, i) => i + 1));
const someOfThem = Array(Math.ceil(capacity / 2) + 1).fill(1).map((el, i) => i + 1);
const existingItems = OrderedSet(someOfThem).intersect(allItems);
expect(allItems.subtract(existingItems).size+someOfThem.length).toBe(allItems.size);