I am currently not succeding in mocking an interface that returns a unique_ptr. For example, given
struct IFoo {
virtual std::unique_ptr foo = 0;
};
int main()
{
MockRepository mocks;
auto foo = mocks.Mock();
…
I'm wondering what hippomocks does to intercept the exit call function for example as shown in the below code:
MockRepository mocks;
mocks.ExpectCallFunc(exit).With(2).Throw(std::exception());
I would like to know if with HippoMock it is possible to mock just a parts of a class.
Example
class aClass
{
public:
virtual void method1() = 0;
void method2(){
do
doSomething; // not a functon
…
HippoMocks documentation says that it can mock C function including Windows API function, but I could not find any example for it. Can anyone give an example for windows API function…
I have a function:
void setData(int *ptr) {
*ptr = 3
};
Can I use Hippomock to mock this function and set the value of ptr?
Something like: mock.OnCallFunc(setData).With(int *ptr).Do({ *ptr = 5;});
So I can do something like this later
int…
While trying to register an expectation using Hippomock's MockRepository::ExpectCall I encounter the NotImplementedException exception at MockRepository::BasicRegisterExpect's following line which I admittedly do not understand:
if ((unsigned…
IEmployeeServiceProxy* empSvcMock = m_Mocks.InterfaceMock();
m_EmpSvcMock.reset(empSvcMock); // shared_ptr because my class Client ctor expects a shared_ptr
Client client(m_EmpSvcMock);
how to prevent…
Imagine we have a unit test that first executes a sequence of code for which we expect a function someFunc not to be called, then executes a sequence of code for which we expect that function to be called exactly once. Using HippoMocks, we could…
I want to isolate writeMemory but i can't because of the following error:
../../Util/UnitTest++/../../UnitTests/KeeperDive_Test.h:66:57: error: expected expression mocks.ExpectCall(Skillmock, Skill::writeMemory).With(template (Skillmock));
class…
I am using Hippomocks and have a class that implements an generic interface. When I place expectations on this class I do not get the expected behaviour.
This is my minimum "working" example
template
struct Foo {
virtual ~Foo() =…
I am getting below error while compiling my test cases derived from testing::Test of google test with C++11. Below error will be thrown if my derived class has HippoMock::MockRepository member.
looser throw specifier for virtual…
I am investigating using mocking for unit tests I'm adding to existing code. For this I'm using HippoMocks. This involves another class calling some methods on my mock (that are all virtual). I want to avoid overspecifying all this but HippoMocks…
Could HippoMocks be used within concurrent testcases just like this:
synchronized startup phase
create mock
register expectations etc.
parallel testing phase
call methods on the mock
synchronized teardown phase
verify the mock
I did not find…
I would like to have multiple tests in multiple files be able to call a separately-compiled utility method from another file that sets up the same expectations for each test. However, Hippomocks seems to have a problem with setting expectations for…
Hippomocks have OnCallFuncOverload macro for mocking overloaded function call. I'm trying to use for mocking function with variable count of args. Can anyone give an example for overloaded function with variable count of args?
My code
void…