Add C API tests for error handling, indexing, and search parameters#306
Open
rfsaliev wants to merge 7 commits into
Open
Add C API tests for error handling, indexing, and search parameters#306rfsaliev wants to merge 7 commits into
rfsaliev wants to merge 7 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new Catch2-based test suite for the SVS C API, wires it into the CMake/CTest build, and refactors dynamic-index deletion to improve error reporting.
Changes:
- Added multiple Catch2 test files covering C API error handling, algorithms, storage, search params, index building/search, and dynamic index operations.
- Added
bindings/c/tests/CMakeLists.txtandbindings/c/tests/README.mdto build and run the new C API tests via CTest. - Refactored
svs_index_dynamic_delete_pointsto split validation and deletion into separate exception-wrapped phases.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| bindings/c/tests/c_api_storage.cpp | Adds storage-handle tests (Simple/LeanVec/LVQ/SQ). |
| bindings/c/tests/c_api_search_params.cpp | Adds search-parameter creation tests and invalid-size coverage. |
| bindings/c/tests/c_api_index_builder.cpp | Adds index-builder creation/config tests (metric/storage/threadpool). |
| bindings/c/tests/c_api_index.cpp | Adds build/search tests plus distance/reconstruct and threadpool management checks. |
| bindings/c/tests/c_api_error.cpp | Adds basic error-handle lifecycle and invalid-call behavior tests. |
| bindings/c/tests/c_api_dynamic_index.cpp | Adds dynamic index build/add/delete/consolidate/compact/search tests. |
| bindings/c/tests/README.md | Documents test structure and build/run instructions. |
| bindings/c/tests/CMakeLists.txt | Builds the C API test executable and integrates with CTest/Catch discovery. |
| bindings/c/src/svs_c.cpp | Refactors svs_index_dynamic_delete_points exception handling. |
| bindings/c/CMakeLists.txt | Introduces SVS_BUILD_C_API_TESTS option and conditionally adds the tests subdir. |
…rch parameters, and storage - Introduced tests for error handling in the C API, ensuring proper creation, cleanup, and state management of error handles. - Implemented tests for index building and searching, covering various scenarios including different metrics, storage types, and threadpool configurations. - Added tests for search parameters creation and validation, including handling of invalid sizes. - Developed tests for storage creation, validating various data types and ensuring proper error handling for invalid arguments. - Ensured all tests utilize the Catch2 framework for consistency and clarity.
46038d6 to
b9020f1
Compare
…orting - Refactor CMake configuration to support coverage options for C API tests. - Update test build options to allow dynamic index testing with configurable block sizes. - Introduce a utility for managing temporary directories in tests. - Improve dynamic index tests to include save/load functionality and multi-threading support. - Update README and test commands for consistency with new test target names.
- Bump project version to 0.4.0 in CMakeLists.txt - Set default C++ standard to 20 if not defined - Change target_link_libraries to target_link_options for coverage - Improve delete_points method in DynamicIndex to handle non-existing IDs - Add tests for deleting existing and non-existing IDs in c_api_dynamic_index.cpp - Include C API header in test utilities for better integration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request introduces a comprehensive C API test suite for the SVS project, leveraging the Catch2 testing framework. It adds new test files covering all major C API functionalities, integrates automated test building and execution into the CMake build system, and improves error handling and testability for dynamic index operations.
C API Test Infrastructure and Test Coverage:
CMakeLists.txtfor the test suite that automatically fetches Catch2 if not found, builds the test executable, and integrates with CTest for automated test discovery and execution.README.mdexplaining test structure, coverage, build/run instructions, and contribution guidelines for new tests.Build System Improvements:
SVS_BUILD_C_API_TESTSCMake option, and added logic to include the tests subdirectory conditionally.Dynamic Index Error Handling:
svs_index_dynamic_delete_pointsto improve error handling: split the operation into two exception-wrapped phases, ensuring correct error reporting when deleting points from a dynamic index.