Closed jafingerhut closed 4 years ago
As a comparison point, with the changes of SHIFT_INCREMENT=2, the same test fails with n=84 (but no smaller).
There is a deftest test case for this issue proposed in PR https://github.com/lacuna/bifurcan/pull/20, as well as another similar test that exposes a similar problem in removeFirst.
The value of n shown below is the smallest one I know of that exhibits this problem.
One issue with generative testing and data structures like List with wide branching factors is that it can take a large number of operations to reach "interesting" tree structures that exercise new code paths. I have found that making a local change with SHIFT_INCREMENT=2 and thus MAX_BRANCHES=(1 << 2) = 4 causes the existing generative tests to find issues like this in a fairly short period of time.
That requires a few replacements of literal constants 5 and 32 in the List.java and ListNodes.java source files to be replaced with appropriate names, to avoid replacing them manually in multiple places. I can submit a PR with such changes if that would be of interest.