This PR introduces a new test to handle edge cases when querying for nearest_n_within. The test is designed to ensure that the nearest_n_within function behaves as expected, particularly with the max_qty and sorted parameters.
Key Changes:
Added a new test function can_query_nearest_n_items_unsorted_max_qty in src/float/query/nearest_n_within.rs.
The test covers scenarios with both non-zero and zero values for 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. When sorted is true, the function handles max_qty = 0 correctly, but when sorted is false, 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.
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.