meekrosoft / fff

A testing micro framework for creating function test doubles
Other
768 stars 169 forks source link

Per Issue #101, #121

Open jackdigitalinsight opened 1 year ago

jackdigitalinsight commented 1 year ago

reset return sequence index when setting a return sequence.

Thank you for your contribution.

Before submitting this PR, please make sure:

I don't have CMake 3.20 to run buildandtest, but here's a suggested addition to test/src/test_cases.include. Should fail with original code and work with update.

TEST_F(FFFTestSuite, return_value_sequence_update)
{
    long myReturnVals[] = { 3, 7 };
    SET_RETURN_SEQ(longfunc0, myReturnVals, 2);
    ASSERT_EQ(myReturnVals[0], longfunc0());
    ASSERT_EQ(myReturnVals[1], longfunc0());
    long moreReturnVals[] = { 9, 11 };
    SET_RETURN_SEQ(longfunc0, moreReturnVals, 2);
    ASSERT_EQ(moreReturnVals[0], longfunc0());
    ASSERT_EQ(moreReturnVals[1], longfunc0());
}