-
Notifications
You must be signed in to change notification settings - Fork 212
PHPC-2634: Binary vector corpus tests #1892
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
Conversation
0dcb4b8 to
8d0b961
Compare
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.
Pull Request Overview
This PR implements test coverage for binary vector corpus tests as specified in PHPC-2634, including support for FLOAT32, INT8, and PackedBit vector types. The changes provide comprehensive testing for vector encoding, decoding, validation, and edge cases.
Key changes:
- Added a script to generate PHPT test files from JSON corpus test definitions
- Generated 26 test files covering various vector types and validation scenarios
- Implemented prose tests for PackedBit vector behavior with non-zero padded bits
Reviewed Changes
Copilot reviewed 25 out of 26 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/convert-bson-binary-vector-tests.php | Script that converts JSON corpus tests into PHPT test files |
| tests/bson-binary-vector/prose_test-001.phpt | Tests encoding PackedBit vectors with non-zero padded bits |
| tests/bson-binary-vector/prose_test-003.phpt | Tests comparison of PackedBit vectors with padding |
| tests/bson-binary-vector/float32-*.phpt | Generated tests for Float32 vector type validation and operations |
| tests/bson-binary-vector/int8-*.phpt | Generated tests for Int8 vector type validation and operations |
| tests/bson-binary-vector/packed_bit-*.phpt | Generated tests for PackedBit vector type validation and operations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (isset($case['canonical_bson'])) { | ||
| $code .= "throws(function() {\n"; | ||
| $code .= sprintf(' var_dump(MongoDB\BSON\Document::fromBSON(hex2bin(%s)));', var_export($case['canonical_bson'], true)) . "\n"; | ||
| $code .= "}, 'MongoDB\Driver\Exception\InvalidArgumentException');"; |
Copilot
AI
Nov 11, 2025
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.
[nitpick] Missing newline character at the end of the string. Add "\n" to maintain consistent formatting with similar statements at lines 169 and 183.
| $code .= "}, 'MongoDB\Driver\Exception\InvalidArgumentException');"; | |
| $code .= "}, 'MongoDB\Driver\Exception\InvalidArgumentException');" . "\n"; |
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.
$code is later trimmed, so no need for extra whitespace here.
https://jira.mongodb.org/browse/PHPC-2634