Skip to content

test(hidi2c): add unit tests for target service - #951

Draft
jerrysxie wants to merge 1 commit into
OpenDevicePartnership:mainfrom
jerrysxie:add-hid-unit-test
Draft

test(hidi2c): add unit tests for target service#951
jerrysxie wants to merge 1 commit into
OpenDevicePartnership:mainfrom
jerrysxie:add-hid-unit-test

Conversation

@jerrysxie

Copy link
Copy Markdown
Contributor

Add unt test for hidi2c target service

file before after Δ covered (after)
attn_pin_handler.rs 0.00% 100.00% +100.00 23 / 23
device_descriptor.rs 0.00% 62.34% +62.34 96 / 154
error.rs 0.00% 25.00% +25.00 3 / 12
service.rs 0.00% 62.12% +62.12 492 / 792
test_support.rs 81.82% (new, test-only) 54 / 66
Total 0.00% 63.80% +63.80 668 / 1047

Add host-side unit tests for the HID-I2C target service. Coverage
includes command-header parsing, SET_REPORT and GET_REPORT handling,
the reset/interrupt handshake, and TimeoutBus timeout and recovery
behavior, plus HID descriptor construction and oversize-rejection
checks.

Introduce a shared test_support module with a generic recording
HidDevice mock so the descriptor and service tests no longer each
define their own near-identical mock. Annotate the command byte
arrays with HID-over-I2C wire-format comments.

Add dev-dependencies (tokio, embassy-time, critical-section) needed
to run the host async tests.

Assisted-by: GitHub Copilot:claude-opus-4.8
@jerrysxie jerrysxie self-assigned this Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant