Skip to content(if available)orjump to list(if available)

FakeIt: C++ Mocking Made Easy

FakeIt: C++ Mocking Made Easy

5 comments

·September 11, 2025

bluGill

I like that they have the verify as a separare / latter step. Most users of google mock see a mock call and assume that they need to force the call - thus if you change the implementation you are breaking tests but the real code still works because that should be an implementation detail.

vhantz

I can not imagine when this type of library becomes useful. What's a usage example for this? What do you gain over rolling your own?

bluGill

It is / or should be less tedious than a writting a custom class with the return values you need for everything.

I still recomend hand written fakes - but only because and if they model real behavior without the unwanted effects. I find my handwritten cods often has more lines of test code to ensure it works than the real implementation.

ch33zer

Seems very inspired by gmock. Wondering if there's a comparison somewhere?

drysine

"On GCC, optimization flag O2 and O3 are not supported. You must compile the test project with -O1 or -O0."

Sounds like they are patching objects in memory. Trompeloeil, for example, doesn't do that.