Hippomocks 2.0 on Mac OS X
I’m exploring Hippomocks, a C++ mock library.
Installation
The library supplies a test suite for compilers not known to be supported. GCC is listed, but I think Apple’s version is a little different than standard GCC, so I’ll run that. Pretty easy in Terminal:
- “cd /path/to/Hippoocks/HippoMocksTest/”
- “make test” (there’s also a test0x, but it requires >= GCC 4.3, which is confirmed when my Mac doesn’t recognize “-std=c++0x”)
And… errors But easy ones to fix…
cc1plus: warnings being treated as errors
../HippoMocks/hippomocks.h:139: warning: ‘class func_index’ has virtual functions but non-virtual destructor
is_virtual.cpp:4: warning: ‘class IL’ has virtual functions but non-virtual destructor
test_class_mock.cpp:24: warning: ‘class IG’ has virtual functions but non-virtual destructor
n.b. the above errors were over several compiles, but I showed them together for brevity.
Picking up where we left off… “make test” now succeeds, and ./test reports:
…[TOTAL](30/30)[OK](30/30)
The final step, per the installation instructions, is to copy the single header file, hippomocks.h, into a system directory. I’m putting it in /usr/local/include.
That’s it! The library is ready for use in all my C++ projects. All I have to do is #include <hippomocks.h> and go to town.