chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes

std::string s{"one"};

WHEN_CALLED(returner->GetString()).Return(BY_VAL(s)); 

is throwing an exception.   Trying to follow the documentation from the "Behavior Settings Type" + "Return".

Here is my complete code (using catch2):

struct MyReturner

{

  int GetInt() { return -1; }

  std::string GetString() { return "-1"; }

};

TEST_CASE("mock return", "[mock]")

{

    MyReturner *returner = FAKE<MyReturner>();

    std::string s{"one"};

    WHEN_CALLED(returner->GetInt()).Return(1);

    WHEN_CALLED(returner->GetString()).Return(BY_VAL(s));

    

    REQUIRE( returner->GetInt() == 1);

    REQUIRE( returner->GetString() == "one" );

}    

Is there a unit test source examples posted somewhere that test most of the functionality of isolator++?

closed with the note: User received answers for his questions.
asked by bjantzen (600 points)
closed by Alon_TypeMock

1 Answer

0 votes
Hi,

Sure, we have an examples project in Isolator++ install directory,

you can see over there, most of the functionality of Isolator++.

Cheers,

Daniel Markov,

Support specialist
answered by Daniel Markov (5.8k points)
...