Skip to content

Add int32 UT assert macro #502

@jphickey

Description

@jphickey

Is your feature request related to a problem? Please describe.
A very common use case in unit testing is to assert on an int32 value, as this is a common return value type for error codes and status values.

UT Assert provides a generic UtAssert_True() macro which can certainly test for integer equality, but it is still very repetitive and test cases may not include all the relevant information. For instance, the framework should encourage/require that the actual values are printed in addition to the pass/fail status, and the generic macro being totally free-form does not enforce this at all.

Describe the solution you'd like
Add a macro UtAssert_INT32_EQ() to check for equality of two values as int32 types.

Other types could be added too, but int32 is by far the most commonly needed as it is the return type of many API calls across OSAL and CFE.

Describe alternatives you've considered
Continue using the generic UtAssert_True() macro.

Additional context
Many test programs already use their own macros for testing return values. They've already evolved to be similar but different (e.g. CFE SB has ASSERT_EQ, and OSAL coverage testing has OSAPI_TEST_FUNCTION_RC()).

It would be worthwhile to put more of these in UT assert itself so these don't need to continue being duplicated.

Requester Info
Joseph Hickey, Vantage Systems, Inc.

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