Is it possible to use "cmocka" in visual studio solution?

336 Views Asked by At

I have tried "cmocka" in visual studio solution, and it works fine with simple asserts. But when it comes to "mocking" I can't find a way to "mock" the functions from the library I am testing.

It is a C project in visual studio and there isn't a "CMakeList.txt" file.

If anyone can help me with a solution, I will be very thankful.

EDIT

What I am trying to do is to test some functions from the library which are more complicated. And I am trying to mock them, is that possible at all?

I am using this as an example: https://gitlab.com/cmocka/cmocka/-/blob/master/example/mock/uptime/….

I am trying to reimplement my function from the library like the one on the example above, using: __wrap_myfunction(int i, char *c); Since my project is not a CMake project, I don't know how to define the "wrap" method.

0

There are 0 best solutions below