Skip to content

Incorrect OrderedSet.subtract result when 32+ elements #1716

Closed
@pixmaster

Description

@pixmaster

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions