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

Scale double values to 4 decimal digits in geoNear test #1197

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

jyemin
Copy link
Collaborator

@jyemin jyemin commented Sep 13, 2023

This works around small variations in native math libraries used by the server.

JAVA-5097

This works around small variations in native math libraries used
by the server.

JAVA-5097
final int scale, final RoundingMode roundingMode) {
List<BsonDocument> expectedResults = parseToList(expectedResultsAsString);
List<BsonDocument> results = getCollectionHelper().aggregate(pipeline);
assertEquals(adjustScale(expectedResults, scale, roundingMode), adjustScale(results, scale, roundingMode));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Another option would have been to perform recursive equality, with an epsilon on floating points. But I don't think we'll have an issue in these tests since the decimal places aren't close to being 0 (which would make the flooring flaky).

Copy link
Contributor

@katcharov katcharov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jyemin jyemin merged commit deed10b into mongodb:master Sep 13, 2023
@jyemin jyemin deleted the j5097 branch September 13, 2023 16:24
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

Successfully merging this pull request may close these issues.

None yet

2 participants