Layout with 11 options using gmock

I use gmock to bully my dependencies in legacy code. One of the classes has a method with 11 parameters. When I tried to use MOCK_METHOD11_WITH_CALLTYPE to mock it, I found that this macro does not exist. gmock only supports up to 10 parameters. What do you suggest for this? Am I implementing this method using a dummy body? Or copy and expand a macro? Thank!

PS, I don’t need to mock this method in my tests right now, but I probably need to do this in the future.

Yours faithfully,

+6
source share
3 answers

10 . , , , . , , . . , 11 3 4. , , .

+6

- gmock, : gmock-more-args

0

, :

struct ParamsMoreThanTen
{
  Param_Type param_1;
  Param_Type param_N;
};

MOCK_METHOD1(methodWithMoreThanTenParms, methodReturnType(ParamsMoreThanTen params));

methodReturnType methodWithMoreThanTenParms(
    Param_Type param_1,
    Param_Type param_N) override
{

  return    methodWithMoreThanTenParms(ParamsMoreThanTen
  {
    Param_Type param_1,
    Param_Type param_N
  });

};
0
source

All Articles