SCH Unit Tests #584
-
I am trying to upgrade the unit tests on the old SCH app to use UTAssert and have been coming across some issues. I set a hook for a CFE function but it never seems to get called. I also tried just setting the default return value and it appears the function isn't returning the value I've set it to. Is there something I'm missing here?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
While it should've been obvious, anything outside the c file you're testing, will be stubbed out by default. Some of the older unit tests (not sure what it was called) will trigger failure conditions from CFE calls to cause a function fail (eg. a custom init from another c file) to return a failure. With the new framework, you can just directly set the return code of any function (assuming you've created the required stubs with the generator or by hand). Changing |
Beta Was this translation helpful? Give feedback.
While it should've been obvious, anything outside the c file you're testing, will be stubbed out by default. Some of the older unit tests (not sure what it was called) will trigger failure conditions from CFE calls to cause a function fail (eg. a custom init from another c file) to return a failure. With the new framework, you can just directly set the return code of any function (assuming you've created the required stubs with the generator or by hand).
Changing
UT_SetDefaultReturnValue(UT_KEY(CFE_TIME_RegisterSynchCallback), !CFE_SUCCESS);
toUT_SetDefaultReturnValue(UT_KEY(SCH_CustomLateInit), !CFE_SUCCESS);
fixed it