Fix #113, replace acknack count union#115
Merged
Conversation
Using a union for the ack/nak counts is somewhat dangerous because undefined behavior will occur if accessed improperly. In this case there is no need to have separate representations of the counter, they are both limited to the "unit8" range, so use a uint8.
Contributor
|
CCB: 2021-12-15 APPROVED!
|
Contributor
Author
|
Hold of a bit on merging, I'm seeing intermittent unit test failures after this one (depends on random values being picked). This fixed a FSW issue (using == instead of >= when checking counter limits) and the unit test appears to be actively checking for the incorrect path being followed. |
The use of random numbers in a couple test cases was causing an unpredictable flow through the code. This replaces with fixed values so get consistent flows. Specifically, the "acknak_count" should always be less than the "ack_limit". The UT use of random numbers allowed it to be greater. However, if it is greater than the limit, it should still follow the limit/error path, not the successful path.
Contributor
Author
|
Minor fix, should be good to go now with commit d800b4b. This just removes the problem random values and puts some fixed numbers to get consistent flow. |
skliper
approved these changes
Dec 17, 2021
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.
Using a union for the ack/nak counts is somewhat dangerous because undefined behavior will occur if accessed improperly. In this case there is no need to have separate representations of the counter, they are both limited to the "unit8" range, so use a uint8.
Fixes #113