Skip to content

Use of hardcoded numbers for bad IDs in OSAL unit tests #515

@jphickey

Description

@jphickey

Is your feature request related to a problem? Please describe.
Some unit tests pass a hardcoded magic number i.e. 99999 to OSAL functions to evoke a bad ID error, such as the case here:

res = OS_TimerSet(99999, 10000, 10000);
if (res == OS_ERR_INVALID_ID)
UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS);
else
UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE);

As the API doesn't specifically dictate what constitutes a good ID vs. a bad ID, there is a possibility that in some OSAL implementation this value 99999 might actually be a valid ID.

This is a concern for black box tests which are supposed to be implementation-agnostic, but need to validate that the correct error is returned when called with a bad ID.

Describe the solution you'd like
The OSAL API should define macro to provide a value which is guaranteed to always be a valid ID. Unit tests can use this symbol instead of the magic number.

Requester Info
Joseph Hickey, Vantage Systems, Inc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementunit-testTickets related to the OSAL unit testing (functional and/or coverage)

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions