test(hts221): Add mock unit tests for HTS221 driver.#169
Open
Charly-sketch wants to merge 1 commit into
Open
Conversation
Add comprehensive desktop unit tests for the HTS221 Arduino driver using MockWire. This introduces a full native test suite covering the public API and core behaviors of the driver, aligned with the project testing conventions and MicroPython scenarios. Key additions: - Device detection: - Test WHO_AM_I register via deviceId() - Test begin() success and failure cases - Power and modes: - Test powerOn() / powerOff() - Test setContinuous() (ODR + PD bit) - Test triggerOneShot() - Status handling: - Test dataReady(), temperatureReady(), humidityReady() - Test partial readiness cases - Measurement logic: - Test read(), temperature(), humidity() - Test readOneShot() - Verify auto-trigger behavior when powered off - Verify no trigger in continuous mode - Error handling: - Test timeout behavior returning NaN when data is not ready - Calibration and processing: - Test humidity clamping (0–100%) - Test temperature offset application - Test user calibration via calibrateTemperature() - Reset: - Test reboot() and softReset() register writes - Shared contract checks: - Integrate driver_checks.h helpers for begin() and WHO_AM_I All tests pass in native environment using: pio test -e native Notes: - Tests are adapted to the current MockWire capabilities (no reset/onRead hooks) - Calibration register mutation tests were avoided in favor of public API testing for reliability and determinism Depends on: - test framework setup (#20) - MockWire implementation (#21)
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.
test(hts221): Add mock unit tests (#22)
Add native unit tests for the HTS221 driver using MockWire.
Closes #22
Covers: