Skip to content
This repository has been archived by the owner on Sep 27, 2021. It is now read-only.

Automate generation of Mock classes from Interface classes #184

Open
rfairley opened this issue Feb 16, 2019 · 0 comments
Open

Automate generation of Mock classes from Interface classes #184

rfairley opened this issue Feb 16, 2019 · 0 comments

Comments

@rfairley
Copy link
Member

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant