Skip to content
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

Add tests for object id inline functions #982

Closed
skliper opened this issue May 5, 2021 · 1 comment · Fixed by #990 or #1006
Closed

Add tests for object id inline functions #982

skliper opened this issue May 5, 2021 · 1 comment · Fixed by #990 or #1006
Assignees
Labels
enhancement unit-test Tickets related to the OSAL unit testing (functional and/or coverage)
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented May 5, 2021

Is your feature request related to a problem? Please describe.
OS_ObjectIdToInteger, OS_ObjectIdFromInteger, OS_ObjectIdEqual, OS_ObjectIdDefined are missing tests.

Describe the solution you'd like
Add tests.

Since these are inline they can be completely exercised via explicit coverage tests (suggest adding to coveragetest-idmap.c).

Note these can be trivial, just need to convert a to and from a range of ID's (note these are just to/from integers, NOT indexes...), check each for equal to itself but not equal to the others, check that OS_OBJECT_ID_UNDEFINED results in undefined and the rest are defined. This also ensures an ID didn't "wrap" by exercising Array Index conversions from array index 0 and max for each type (as defined in configuration).

Describe alternatives you've considered
Could be added to a "functional/full stack" test but no point since they don't have any external dependencies.

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC

@skliper skliper added enhancement unit-test Tickets related to the OSAL unit testing (functional and/or coverage) labels May 5, 2021
@skliper skliper added this to the 6.0.0 milestone May 5, 2021
@skliper
Copy link
Contributor Author

skliper commented May 5, 2021

Initial brainstorming thoughts:
Create an array of ID's with two entries for each valid type, use the FromArrayIndex API to create them using 0 and the configured maximum, check that they all return true for OS_ObjectIdIsDefined, confirm OS_OBJECT_ID_UNDEFINED returns false. Create a second array, and use OS_ObjectIdToInteger and OS_ObjectIdFromInteger to fill in the values using the initial set. Then do a double loop (i, j) through the values, comparing the first array to the second and only when i = j should OS_ObjectIdEqual be true

I think that would cover it...

EDIT: Whoops, there may not be a FromArrayIndex... may just need to create all the ID's (seems like overkill, but I'm not sure how else to get the max. Maybe there is a coverage test utility to do the conversion? Could just keep creating them until it errors, then check the max (converted) index against the maximum configured value.

zanzaben added a commit to zanzaben/osal that referenced this issue May 7, 2021
zanzaben added a commit to zanzaben/osal that referenced this issue May 7, 2021
zanzaben added a commit to zanzaben/osal that referenced this issue May 10, 2021
zanzaben added a commit to zanzaben/osal that referenced this issue May 12, 2021
zanzaben added a commit to zanzaben/osal that referenced this issue May 13, 2021
zanzaben added a commit to zanzaben/osal that referenced this issue May 13, 2021
zanzaben added a commit to zanzaben/osal that referenced this issue May 14, 2021
jphickey added a commit to zanzaben/osal that referenced this issue May 14, 2021
This cuts the number of logged test cases from nearly 80k to about 580.
jphickey added a commit to zanzaben/osal that referenced this issue May 14, 2021
This cuts the number of logged test cases from nearly 80k to about 580.
jphickey added a commit to zanzaben/osal that referenced this issue May 14, 2021
This cuts the number of logged test cases from nearly 80k to about 580.
astrogeco added a commit that referenced this issue May 18, 2021
Fix #982, Add test for object id inline functions
pepepr08 pushed a commit to pepepr08/osal that referenced this issue Jun 9, 2021
pepepr08 pushed a commit to pepepr08/osal that referenced this issue Jun 9, 2021
This cuts the number of logged test cases from nearly 80k to about 580.
jphickey added a commit to jphickey/osal that referenced this issue Aug 10, 2022
Define a data structure in cfe_sb_msg.h that will be used
with the "write pipe info" command (CFE_SB_SEND_PIPE_INFO_CC).

This allows the internal CFE_SB_PipeD_t descriptor object to
evolve as needed without affecting the binary format of the
file that is generated form this command, and items such
as memory pointers may be excluded from the file.
jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement unit-test Tickets related to the OSAL unit testing (functional and/or coverage)
Projects
None yet
2 participants