Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky test ParallelIterableTestCase#sumOfFloatConsistentRounding. #1706

Open
motlin opened this issue Sep 15, 2024 · 0 comments
Open

Fix flaky test ParallelIterableTestCase#sumOfFloatConsistentRounding. #1706

motlin opened this issue Sep 15, 2024 · 0 comments

Comments

@motlin
Copy link
Contributor

motlin commented Sep 15, 2024

This test sometimes fails with a delta greater than the allowed delta.

[ERROR]   ParallelCollectListIterableTest>ParallelIterableTestCase.sumOfFloatConsistentRounding:894 Batch size: 1000 ==> expected: <5.0000000000000995> but was: <5.000000000000101>

The test:

    @Test
    public void sumOfFloatConsistentRounding()
    {
        FloatFunction<Integer> roundingSensitiveElementFunction = i -> (i <= 99995) ? 1.0e-18f : 1.0f;

        MutableList<Integer> list = Interval.oneTo(100_000).toList().shuffleThis();
        double baseline = this.getExpectedWith(list.toArray(new Integer[]{}))
                .sumOfFloat(roundingSensitiveElementFunction);

        for (Integer batchSize : BATCH_SIZES)
        {
            this.batchSize = batchSize;

            ParallelIterable<Integer> testCollection = this.newWith(list.toArray(new Integer[]{}));
            assertEquals(
                    baseline,
                    testCollection.sumOfFloat(roundingSensitiveElementFunction),
                    1.0e-15,
                    "Batch size: " + this.batchSize);
        }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant