File | Date | Author | Commit |
---|---|---|---|
cxxmock | 2014-11-21 |
![]() |
[c0acab] Updated for using with CxxTest 4.4 |
docs | unknown | ||
tests | 2014-11-21 |
![]() |
[a159f8] Fixed parsing function arguments with reference... |
.gitmodules | 2014-11-21 |
![]() |
[23bfd3] added cxxtest as module |
.travis.yml | unknown | ||
COPYING.txt | 2014-11-21 |
![]() |
[cce516] Copied from SourceForge |
CREDITS | 2014-11-21 |
![]() |
[cce516] Copied from SourceForge |
Makefile | 2014-11-21 |
![]() |
[cce516] Copied from SourceForge |
Readme.md | 2014-11-21 |
![]() |
[3e02fe] reverted status |
cxxmockgen.py | 2014-11-21 |
![]() |
[a159f8] Fixed parsing function arguments with reference... |
The CxxMock framework provides easy-to-use Mock objects for C++ unit-testing. I've tried to implement Rhino.Mocks idea. It works!
:::bash
python cxxmockgen.py <header.h> <header.h>.... >generated_mocks.h
:::C++
#include "generated_mocks.h"
...
...
... in test case:
//Declare repository.
CxxMock::Repository mocks;
//Gets interface mock.
IMyCoolInterface* mock = mocks.create<IMyCoolInterface>();
//record expectations.
TS_EXPECT_CALL( mock->method(10) ).returns( 5 );
//or void:
TS_EXPECT_CALL_VOID( mock->voidMethod() );
//start replaying recorded calls.
mocks.replay();
//run subsystem wich used mock interfaces:
TS_ASSERT_EQUALS( 5, mock->method(10) );
mock->voidMethod();
//verify not called methods.
mocks.verify();