[Tests] Add unit tests for Thermostat Server Presets functionality#43585
[Tests] Add unit tests for Thermostat Server Presets functionality#43585lboue wants to merge 11 commits intoproject-chip:masterfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds unit tests for the Thermostat Server's presets functionality. The changes include a new test file, test stubs for ZAP-generated code, and build file updates. The new test correctly verifies that SetActivePreset calls the appropriate delegate method. My main feedback is to improve the test implementation by adhering to the project's best practices for accessing private members, specifically avoiding the use of #define private public and instead using a TestAccess helper class as recommended by the unit testing guide.
|
PR #43585: Size comparison from 2403f0a to 28ef21c Full report (32 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, nxp, psoc6, qpg, realtek, stm32, telink)
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #43585 +/- ##
==========================================
+ Coverage 54.07% 54.13% +0.05%
==========================================
Files 1548 1551 +3
Lines 106709 106957 +248
Branches 13308 13308
==========================================
+ Hits 57704 57898 +194
- Misses 49005 49059 +54 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fix Thermostat server test builds where no Thermostat endpoint is configured (e.g. nRF native_posix unit-test config), which caused: error: too many initializers for 'Delegate* [0]'. - add kThermostatStorageEndpointCount as a storage-safe count (max(1, kThermostatEndpointCount)) - use it for gDelegateTable in thermostat-server.cpp - use it for mAtomicWriteSessions in thermostat-server.h - keep runtime behavior unchanged (kThermostatEndpointCount still drives endpoint logic) Validated with: source scripts/activate.sh && gn gen out/pr43585_fix && ninja -C out/pr43585_fix src/app/tests:tests -j2
|
Fixed the nRF CI failure in Root cause: this test config builds Thermostat sources with Fix: introduced a storage-safe count ( Validated locally with: |
|
PR #43585: Size comparison from 2403f0a to 2457ccf Full report (21 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, nrfconnect, psoc6, qpg, realtek, stm32)
|
|
PR #43585: Size comparison from 2403f0a to 4fb4165 Full report (5 builds for cc32xx, realtek, stm32)
|
Summary
Add unit tests for Thermostat Server Presets functionality
Related issues
#43586
Testing
TestThermostatServerPresets.cppsource scripts/activate.sh && gn gen out/pr43585_fix && ninja -C out/pr43585_fix src/app/tests:tests -j2Include not allowedand orphan GN issuesReadability checklist
The checklist below will help the reviewer finish PR review in time and keep the
code readable:
descriptive
“When in Rome…”
rule (coding style)
See: Pull Request Guidelines