-
Notifications
You must be signed in to change notification settings - Fork 40
Add C API tests for error handling, indexing, and search parameters #306
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
base: dev/c-api
Are you sure you want to change the base?
Changes from all commits
07a2493
7c65698
ef0e074
46038d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -661,20 +661,32 @@ extern "C" size_t svs_index_dynamic_delete_points( | |||||
| svs_index_h index, const size_t* ids, size_t num_ids, svs_error_h out_err | ||||||
| ) { | ||||||
| using namespace svs::c_runtime; | ||||||
| return wrap_exceptions( | ||||||
| std::shared_ptr<DynamicIndex> dynamic_index_ptr; | ||||||
| auto result = wrap_exceptions( | ||||||
| [&]() { | ||||||
| EXPECT_ARG_NOT_NULL(index); | ||||||
| EXPECT_ARG_NOT_NULL(ids); | ||||||
| EXPECT_ARG_GT_THAN(num_ids, 0); | ||||||
| auto dynamic_index_ptr = std::dynamic_pointer_cast<DynamicIndex>(index->impl); | ||||||
| dynamic_index_ptr = std::dynamic_pointer_cast<DynamicIndex>(index->impl); | ||||||
| INVALID_ARGUMENT_IF( | ||||||
| dynamic_index_ptr == nullptr, "Index does not support dynamic updates" | ||||||
| ); | ||||||
| return dynamic_index_ptr->delete_points(std::span(ids, num_ids)); | ||||||
| return 0; // return 0 for success, actual deletion happens in the next | ||||||
| // wrap_exceptions call | ||||||
| }, | ||||||
| out_err, | ||||||
| static_cast<size_t>(-1) | ||||||
| ); | ||||||
| if (result != 0) { | ||||||
| return result; | ||||||
| } | ||||||
| // Call delete_points in a separate wrap_exceptions to return 0 if no entries are | ||||||
| // deleted. | ||||||
| return wrap_exceptions( | ||||||
| [&]() { return dynamic_index_ptr->delete_points(std::span(ids, num_ids)); }, | ||||||
| out_err, | ||||||
| 0 | ||||||
|
||||||
| 0 | |
| static_cast<size_t>(-1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SVS_BUILD_C_API_TESTSdefaults to ON, which means building the C API will build the test executable (and potentially FetchContent-download Catch2) by default. This differs from the repo’s other test knobs (e.g.,SVS_BUILD_TESTS/SVS_BUILD_RUNTIME_TESTS, which are opt-in) and can be surprising for consumers embeddingbindings/c. Consider defaulting this option to OFF (or tying it to the parent project’s test option) so tests are only built when explicitly requested.