sinojelly / mockcpp

Two C/C++ testing tools, mockcpp and testngpp.
Apache License 2.0
66 stars 39 forks source link

How to returnStringvalue using MOCKER assertion? #38

Closed hanishgopi closed 1 year ago

hanishgopi commented 2 years ago

Please leave a syntax example to returnStringValue using MOCKER assertion. if not possible using MOCKER assertion if there is any other way please let me know with a sample example.

sinojelly commented 2 years ago

I think maybe you can use return string value mocker like this:

    TEST(test_func_mocker)
    {
        MOCKER(Interface::func)
            .expects(once())
            .will(returnValue("OK"));
        ASSERT_STREQ("OK", Interface::func());
        GlobalMockObject::verify();
    }