New user comments

Skip to first unread message

Philippe A.

Jul 26, 2010, 5:46:52 PM7/26/10
to Cmockery

I have been looking at how I could integrate cmockery with an existing
C project. I am looking for ideas on how to solve the following

- What do I need to generate mocks automatically? Is a C parser what I
need (ex pycparser)? Are there better or simpler choices? Has someone
written a script for this already?

- I was a bit surprised at first when I saw that expectations have to
be set up with each individual parameter. I guess there's no other way
around this as far as a pure C framework is concerned. I would like a
lot more setting expectations a la cmock (my other contender)? Ex:

addFunc_ExpectAndReturn(int a, int b, int toReturn);

Once I have a script generating mocks, I guess nothing would stop me
from generating functions that facilitates expectation setup.

// generated
void addFunc_ExpectAndReturn(int _a, int _b, int _toReturn) {
expect_value(addFunc, a, _a);
expect_value(addFunc, b, _b);
will_return(addFunc, _toReturn);


Bob Gong

Jul 27, 2010, 3:11:42 AM7/27/10
to Cmockery
I have integrated cmockery with our existing C & C++ mixed project, it
worked well.

We developed a script to generate mocks automatically. It doesn't
always work, people need to fix it manually sometimes.
Reply all
Reply to author
0 new messages