Google Mock - 如何命名模拟函数?

Google Mock - how to name mock functions?

我刚刚开始使用 Google Mock。 For Dummies 相当容易理解。

但是,我不明白为什么这个例子有

class MockTurtle : public Turtle {
 public:
  ...
  MOCK_METHOD0(PenUp, void());
  MOCK_METHOD0(PenDown, void());
  MOCK_METHOD1(Forward, void(int distance));
  MOCK_METHOD1(Turn, void(int degrees));
  MOCK_METHOD2(GoTo, void(int x, int y));
  MOCK_CONST_METHOD0(GetX, int());
  MOCK_CONST_METHOD0(GetY, int());
};

有多个MOCK_METHOD0和多个MOCK_METHOD1等。具有相似签名的函数似乎获得相同的模拟编号,但文档没有提及这一点,解释了如何&为什么,以及定义是相同的。我怎么知道该做什么?

How to Define It部分,是这样解释的:

  1. In the public: section of the child class, write MOCK_METHODn(); (or MOCK_CONST_METHODn(); if you are mocking a const method), where n is the number of the arguments; if you counted wrong, shame on you, and a compiler error will tell you so.