Kevin Liang
Kevin Liang

Reputation: 206

How to mock a C-function using OCMock

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

Upvotes: 2

Views: 2108

Answers (2)

Víctor B.
Víctor B.

Reputation: 1680

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).

Upvotes: 2

Ben Flynn
Ben Flynn

Reputation: 18922

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

Upvotes: 1

Related Questions