Can a real function implementation be used as a default handler for a unit test stub? #692
Unanswered
LucienMorey
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have functions that read data buffers directly from a wire and handle endianness transforms to return a proper data type in a common utility library like the one shown below. I can unit-test this function and confirm it works exactly as expected, which is great.
Suppose I use this function in another library's function, like one that implements a decode for a HAL. The function is automatically stubbed out, and the real implementation is ignored in this situation. This is not ideal behaviour because even though the function itself is not subject to testing, its real implementation is required to validate the decode of a byte stream containing multiple sequential fields against data with a known value. Can a real function implementation be used as the default handler for a unit test stub in this situation?
Regards,
Lucien
Beta Was this translation helpful? Give feedback.
All reactions