-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Increase unit test code coverage of controller/
by 2.3%
#39941
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
base: master
Are you sure you want to change the base?
Increase unit test code coverage of controller/
by 2.3%
#39941
Conversation
- Test that the initial value of the last received sequence number is zero. - Test that the initial value of the newest unacknowledged sent sequence number is zero. - Test that sending a packet updates the unacknowledged sequence number correctly and that receiving an acknowledgment updates the state as expected.
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 Review
This pull request increases unit test coverage for AutoCommissioner
and BtpEngine
by adding several new test cases. The approach of using a test accessor class to test private functionality is sound. My review focuses on improving code clarity, consistency with the project's coding style, and fixing minor typos. I've provided specific suggestions for these improvements.
5dd2c20
to
af8316a
Compare
PR #39941: Size comparison from 1446be8 to 2869de6 Full report (9 builds for cc13x4_26x4, cc32xx, stm32, tizen)
|
PR #39941: Size comparison from 1446be8 to e38318a Full report (72 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
PR #39941: Size comparison from eae1a24 to e97f8fc Full report (59 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
|
||
namespace Test { | ||
|
||
class AutoCommissionerTestAccess |
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.
Maybe consider adding a short comment.
EXPECT_EQ(stage, kCleanup); | ||
} | ||
|
||
TEST_F(AutoCommissionerTest, NextStageReadCommissioningInfo) < F363 /td> |
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.
Maybe consider adding a short comment.
EXPECT_EQ(nextStageReadCommissioningInfo, nextStageSendNOC); | ||
} | ||
|
||
TEST_F(AutoCommissionerTest, NextStageConfigureTCAcknowledgments) |
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.
Maybe consider adding a short comment.
Summary
This PR adds five new test cases to
TestAutoCommissioner.cpp
to improve test coverage of the commissioning stage progression in theGetNextCommissioningStageInternal
function.The new tests verify the following scenarios:
NextCommissioningStage
: Ensures the linear and expected transition between stages.NextStageStopCommissioning
: Ensures that if commissioning is manually stopped, the next stage correctly transitions tokCleanup
.NextCommissioningStageAfterError
: Ensures that if commissioning fails due to an error, the next stage correctly transitions tokCleanup
.NextStageReadCommissioningInfo
: Checks that the stage transitions correctly based on the state ofDeviceCommissioningInfo
and UTC requirements.NextStageConfigureTCAcknowledgments
: Verifies the stage transition is correct depending on theDeviceCommissioningInfo
,CommissioningParameters
configuration andTimeZone
arguments.Implementation Notes
Testing of the private
GetNextCommissioningStageInternal
function is accomplished via aAutoCommissionerTestAccess
class, in accordance with the testing guidelines defined in the Connected Home IP unit testing documentation.Related issues
Fixes: #37233
Testing
This PR only adds new unit tests. The sole change to production code is the addition of a
friend
function to grant the tests access.Coverage Impact of
AutoCommissioner.cpp
/controller
folder