How to mock a C-function using OCMock

冷暖自知 提交于 2019-12-11 01:24:17

问题


How do I mock a custom c-lib function using ocmock? Couldn't find anything on google, and any method stubbing functions from OCMock doesn't work


回答1:


One solution could be to encapsulate that functions inside an static class and mock it. In this way you can test the functions itself and mock his usage (using the static class).




回答2:


You cannot mock C functions with OCMock. You will need to use another framework.



来源:https://stackoverflow.com/questions/21685695/how-to-mock-a-c-function-using-ocmock

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!