[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fundamental question: How to resolve dependencies with mock objects

Hi Andreas

Where is the mission statement?


On 27 May 2014, at 15:47, Andreas Schneider wrote:

On Tuesday 27 May 2014 15:02:21 James Grenning wrote:
Maybe we are not talking about the same chapter.  My fault.

cmocka lives with all the limitations of C when trying to bind a
test-double. Options are link-time binding, function pointers or
preprocessor substitution. I barely discussed preprocessor substitution
in the book, but I have numerous articles on my blog.

cmocka implements several function which help you to do mocking. It leaves the
way open how you do it.

cmocka is just C code. So it has no monopoly on being the one way to do mocking in C. IMO cmocka's advantage is it is small and written only in
C.  C-only has benefits and limitations too, which I discuss in the

See also the mission statement ;)

cmocka also does a few things in an odd way. For example, setup
and teardown are not like setup and teardown in other xunit frameworks.
I forget the details, but remember being surprised.

setup and teardown are treated the same way as a test.

	-- andreas

Andreas Schneider                   GPG-ID: CC014E3D
www.cryptomilk.org                asn@xxxxxxxxxxxxxx