mock++ is a jmock-like generic easy-of-use C++ Mock Framework, creating a mock object by mock++ is virtually as easy as using jMock.
IMPORTANT: The repository has been move to bitbucket, in case you need to checkout the latest change.
mock++ 2.6 is avaliable for downloading now, the main changes of this release are:
- supported both IA32 & IA64 platform (MSVC & GCC)
- supported using parameter directly while setting an eq() constraint.
mock++ 2.4 is avaliable for downloading now, the main changes of this release are:
- Added support for mocking free functions & static class methods without using macro MOCKABLE (only for MSVC);
- Fully switched the building system to cmake;
- Changed some implementation to work with TestNG++。
- Automatic type inference of integer types (
long
/unsigned long
,int
/unsigned int
,short
/unsigned short
,char
/unsigned char
) is supported; - Using CMake as the building system, rather than putting MSVC project files into repository directly.
- MSVC 2008 is supported, except for the RTTI capabilities (which means dynamic_cast does not work correctly, basically, it always returns 0).
- Supported cygwin (tested under cygwin 1.5.25-15 with g++ 3.4.4)
- Advanced Guide (English Version)
- down cast by dynamic_cast is supported;
- Able to specifing the life cycle of a mock object, and a mock object could be performed
delete
operation(not "::operator delete") safely. - const reference type of return value of a mocked method is fully supported.
- ignoreReturnValue() is deprecated. Actually it's not allowed to use it any longer. Instead, you should always specify the return behavior in a mock specification.
- Added some configure parameters to change the default settings
- Some minor bugs were fixed
- Define mock classes for interfaces is not required any longer (Only working with g++ so far)
- Refactored some concepts to make them more clear and easy to understand
- Supporting mocking C function easily (g++ > 3 / MSVC > 6)
- Added .then(stub) after .will(stub) to make specifying complex invocation behavior much easier
- Allow specifying more order-related constraints by using multiple before()/after()
- Added some useful extensions (repeat(), increase(), throws(), startWith(), endWith(), contains(), etc.)
- Chinese User Manual
You can download the latest version from download page, or you can go to source page to checkout from svn to get the lastest change, in which some bugs might have been fixed.
Should you have any suggestions or questions, please mailto:dev.mockcpp@gmail.com