What is the best way to test functions that use std functions? #609
-
Hi, I have set up an application that's designed to interface with a shell and will call shell commands with popen, fread and pclose. I am not sure what the best way to unit test this case is because there are no stubs to force returns. Is it possible to manually write stubs for these functions? I see this may have been possible at some point since Is there a recommended way to do this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Writing stubs is the suggested pattern. OSAL does it quite a bit. See https://github.com/nasa/osal/tree/main/src/unit-test-coverage/ut-stubs. |
Beta Was this translation helpful? Give feedback.
Writing stubs is the suggested pattern. OSAL does it quite a bit. See https://github.com/nasa/osal/tree/main/src/unit-test-coverage/ut-stubs.