mirror of
https://github.com/typesense/typesense.git
synced 2025-05-24 15:50:42 +08:00
Add test case.
This commit is contained in:
parent
8520e785cc
commit
06b46ab961
@ -57,7 +57,10 @@ void NumericTrie::search_greater(const int32_t& value, const bool& inclusive, ui
|
||||
|
||||
if (value >= 0) {
|
||||
uint32_t* positive_ids = nullptr;
|
||||
positive_trie->search_greater(inclusive ? value : value + 1, positive_ids, ids_length);
|
||||
uint32_t positive_ids_length = 0;
|
||||
positive_trie->search_greater(inclusive ? value : value + 1, positive_ids, positive_ids_length);
|
||||
|
||||
ids_length = positive_ids_length;
|
||||
ids = positive_ids;
|
||||
} else {
|
||||
// Have to combine the results of >value from negative_trie and all the ids in positive_trie
|
||||
|
@ -188,4 +188,9 @@ TEST_F(NumericRangeTrieTest, SearchGreater) {
|
||||
for (uint32_t i = 5, j = 0; i < pairs.size(); i++, j++) {
|
||||
ASSERT_EQ(pairs[i].second, ids[j]);
|
||||
}
|
||||
|
||||
trie->search_greater(100000, false, ids, ids_length);
|
||||
ids_guard.reset(ids);
|
||||
|
||||
ASSERT_EQ(0, ids_length);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user