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++?