in src/umockcallrecorder.c [790:831]
int umockcallrecorder_can_call_fail(UMOCKCALLRECORDER_HANDLE umock_call_recorder, size_t index, int* can_call_fail)
{
int result;
/* Codes_SRS_UMOCKCALLRECORDER_31_056: [ If umock_call_recorder or call_can_fail is NULL, umockcallrecorder_can_call_fail shall return a non-zero value. ]*/
if ((umock_call_recorder == NULL) ||
(can_call_fail == NULL) ||
/* Codes_SRS_UMOCKCALLRECORDER_31_057: [ If index is greater or equal to the current expected calls count, umockcallrecorder_can_call_fail shall return a non-zero value. ]*/
(index >= umock_call_recorder->expected_call_count))
{
result = MU_FAILURE;
UMOCK_LOG("umockcallrecorder_can_call_fail: NULL Invalid arguments, umock_call_recorder = %p, index = %zu",
umock_call_recorder, index);
}
else
{
/* Codes_SRS_UMOCKCALLRECORDER_01_092: [ If a lock was created for the call recorder, umockcallrecorder_can_call_fail acquire the lock in exclusive mode. ]*/
internal_lock_acquire_shared_if_needed(umock_call_recorder);
{
/* Codes_SRS_UMOCKCALLRECORDER_31_061: [ umockcallrecorder_can_call_fail shall determine whether given call can fail or not by calling umockcall_get_call_can_fail. ]*/
int can_call_fail_result = umockcall_get_call_can_fail(umock_call_recorder->expected_calls[index].umockcall);
if (can_call_fail_result == -1)
{
/* Codes_SRS_UMOCKCALLRECORDER_31_058: [ If umockcall_get_call_can_fail returns -1, umockcallrecorder_can_call_fail shall return an error to the caller ]*/
result = MU_FAILURE;
UMOCK_LOG("umockcallrecorder_fail_call: umockcall_set_fail_call failed.");
}
else
{
/* Codes_SRS_UMOCKCALLRECORDER_31_059: [ umockcallrecorder_can_call_fail shall return in the can_call_fail argument whether the call can fail or not. ]*/
*can_call_fail = can_call_fail_result;
/* Codes_SRS_UMOCKCALLRECORDER_31_060: [ On success umockcallrecorder_can_call_fail shall return 0. ]*/
result = 0;
}
/* Codes_SRS_UMOCKCALLRECORDER_01_094: [ If a lock was created for the call recorder, umockcallrecorder_can_call_fail shall release the exclusive lock. ]*/
internal_lock_release_shared_if_needed(umock_call_recorder);
}
}
return result;
}