‘class MockTurtle’ has no member named ‘gmock_PendDown’

3,563 views
Skip to first unread message

Gaetano Mendola

unread,
Feb 22, 2014, 5:47:04 PM2/22/14
to googl...@googlegroups.com
Hi all,
I'm having compilation issue in a new project (I'm using it successfully in another project),
even following the guide is not helping:

class Turtle {
 public:
  Turtle() { }
  virtual ~Turtle() {}
  virtual void PenUp() = 0;
  virtual void PenDown() = 0;
  virtual void Forward(int distance) = 0;
  virtual void Turn(int degrees) = 0;
  virtual void GoTo(int x, int y) = 0;
  virtual int GetX() const = 0;
  virtual int GetY() const = 0;
};


class MockTurtle : public Turtle {
 public:
  MockTurtle() { }
  ~MockTurtle() { }
  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());
};

TEST(Turtle, ctor) {
  MockTurtle myTurtle;
  EXPECT_CALL(myTurtle, PendDown()).Times(AtLeast(1));
}

It seems all in place to me, but this is the error when compiling:

turtle_test.cpp: In member function ‘virtual void Turtle_ctor_Test::TestBody()’:
/home/kalman/gmock-1.7.0/include/gmock/gmock-spec-builders.h:1788:12: error: ‘class MockTurtle’ has no member named ‘gmock_PendDown’
     ((obj).gmock_##call).InternalExpectedAt(__FILE__, __LINE__, #obj, #call)
            ^
/home/kalman/gmock-1.7.0/include/gmock/gmock-spec-builders.h:1789:32: note: in expansion of macro ‘GMOCK_EXPECT_CALL_IMPL_’
 #define EXPECT_CALL(obj, call) GMOCK_EXPECT_CALL_IMPL_(obj, call)
                                ^
/home/kalman/bowling2/turtle_test.cpp:10:3: note: in expansion of macro ‘EXPECT_CALL’
   EXPECT_CALL(myTurtle, PendDown()).Times(AtLeast(1));


Anyone is spotting what I'm doing wrong here ?

Regards
Gaetano Mendola




Billy Donahue

unread,
Feb 22, 2014, 7:35:21 PM2/22/14
to Gaetano Mendola, googl...@googlegroups.com
PenDown, not PendDown.


--
 
---
You received this message because you are subscribed to the Google Groups "Google C++ Mocking Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to googlemock+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/googlemock/50ce61b3-8991-4a11-a686-b799f3410944%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Gaetano Mendola

unread,
Feb 27, 2014, 11:58:25 AM2/27/14
to Billy Donahue, googl...@googlegroups.com
I guess I need to sleep more :D
Reply all
Reply to author
Forward
0 new messages