INT32 shellInit(shell_t *shell)
{
INT32 ret = ZKOS_SUCCESS;
/* initialize shell device */
if (shell->dev->ops->init)
{
if ((ret = shell->dev->ops->init(shell->dev)) != ZKOS_SUCCESS)
{
ZKOS_LOG("fail to initialize shell device.\n");
return ret;
}
}
...
return ret;
}
As the above code shows, shellInit
calls a function by a function pointer shell->dev->ops->init
, which has been assigned to a function defined in another file. How to mock this called function?