Google Mock Turtle-Painter example

pgrozav:ex2>for f in turtle.h mock_turtle.h painter.h mock_turtle_test.cc run.sh; do echo ==========$f==========; cat $f; done && ./turtle_test
==========turtle.h==========
#pragma once

class Turtle
{
public:
        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;
};
==========mock_turtle.h==========
#pragma once

#include "turtle.h"
#include "gmock/gmock.h" // Brings in Google Mock

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());
};
==========painter.h==========
#pragma once
#include "turtle.h"

class Painter
{
        Turtle * turtle;
public:
        Painter( Turtle * turtle): turtle(turtle){}
        bool DrawCircle(int, int, int)
        {
                turtle->PenDown();
                return true;
        }
};
==========mock_turtle_test.cc==========
#include "mock_turtle.h"
#include "painter.h"

#include "gtest/gtest.h"

using ::testing::AtLeast;

TEST(PainterTest, CanDrawSomething)
{
        MockTurtle turtle;
        EXPECT_CALL(turtle, PenDown()).Times(AtLeast(1));
        Painter painter(&turtle);

        EXPECT_TRUE(painter.DrawCircle(0,0,10));
}

int main(int argc, char** argv)
{
        // The following line must be executed to initialize Google Mock
        // (and Google Test) before running the tests.
        ::testing::InitGoogleMock(&argc, argv);
        return RUN_ALL_TESTS();
}
==========run.sh==========
g++ mock_turtle_test.cc -o turtle_test -I../googletest/googlemock/include -I../googletest/googletest/include -lgtest -L../googletest/googletest/build -lgmock -L../googletest/googlemock/build -lpthread &&
./turtle_test
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from PainterTest
[ RUN      ] PainterTest.CanDrawSomething
[       OK ] PainterTest.CanDrawSomething (0 ms)
[----------] 1 test from PainterTest (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (0 ms total)
[  PASSED  ] 1 test.