This repository was archived by the owner on Jul 23, 2021. It is now read-only.
This repository was archived by the owner on Jul 23, 2021. It is now read-only.
Incorrect OrderedSet.subtract result when 32+ elements #139
Closed
Description
From @pixmaster on Thu, 13 Jun 2019 11:46:48 GMT
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);
Copied from original issue: immutable-js#1716