Skip to content

simplify unit tests with utassert.h macros #397

@CDKnightNASA

Description

@CDKnightNASA

Is your feature request related to a problem? Please describe.
Currently a lot of OSAL unit test code is like the following (basically, run code, check the result, "force" an assert that it worked or didn't work):

    /*-----------------------------------------------------*/
    testDesc = "#2 Name-too-long-arg";

    res = OS_xxx(aVeryLoooooongName);
    if (res == OS_ERR_NAME_TOO_LONG)
        UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS);
    else
        UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE);

Describe the solution you'd like
Instead, this can be simplified to:

  UtAssert_True(OS_xxx(aVeryLoooooongName) == OS_ERR_NAME_TOO_LONG, "#2 Name-too-long-arg");

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context about the feature request here.

Requester Info
[email protected]

Metadata

Metadata

Assignees

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