utra-robosoccer / soccer-embedded

Collection of embedded programs for an autonomous humanoid soccer robot
http://utrahumanoid.ca
32 stars 8 forks source link

Automate generation of Mock classes from Interface classes #184

Open rfairley opened 5 years ago

rfairley commented 5 years ago

Describe the feature Provide an automated way to write the declarations for a class like MockOsInterface from OsInterface. I.e., translate a virtual Interface function definition into a gmock Mock class function definition.

This involves writing out the googletest macros like:

OsInterface.h

    virtual int32_t OS_osSemaphoreWait (
        osSemaphoreId semaphore_id,
        uint32_t millisec
    ) const = 0;

MockOsInterface.h

    MOCK_CONST_METHOD2(
        OS_osSemaphoreWait,
        int32_t(
            osSemaphoreId,
            uint32_t millisec
        )
    );

Reason for request Similar to #183, this is to save time writing out the googletest declarations manually when it is a mostly mechanical process.

Timeline No timeline - not urgent.

Additional information googletest/googlemock is a popular framework, so there may already be tools that can do this in a generalized way. We should see what existing tools there are before writing our own.