Added test to capture edge cases with unsorted count #180
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a new test to handle edge cases when querying for
nearest_n_within
. The test is designed to ensure that thenearest_n_within
function behaves as expected, particularly with themax_qty
andsorted
parameters.Key Changes:
can_query_nearest_n_items_unsorted_max_qty
insrc/float/query/nearest_n_within.rs
.max_qty
, verifying that the function returns the correct number of results when sorted or unsorted.Confirmation of Fix:
This test confirms that the fix introduced in PR #175 for issue #168 works as intended.
However, it also reveals that the function behaves differently when
max_qty
is set to 0, depending on whether the results are sorted or not. Whensorted
istrue
, the function handlesmax_qty
= 0 correctly, but whensorted
isfalse
, it fails to return the expected empty result set.This addition helps to ensure that edge cases are handled correctly and that the
nearest_n_within
function performs consistently under various conditions.