in src/umockcall.c [88:137]
int umockcall_are_equal(UMOCKCALL_HANDLE left, UMOCKCALL_HANDLE right)
{
int result;
if (left == right)
{
/* Codes_SRS_UMOCKCALL_01_024: [ If both left and right pointers are equal, umockcall_are_equal shall return 1. ] */
result = 1;
}
else if ((left == NULL) || (right == NULL))
{
/* Codes_SRS_UMOCKCALL_01_015: [ If only one of the left or right arguments are NULL, umockcall_are_equal shall return 0. ] */
result = 0;
}
else
{
if (left->umockcall_data_are_equal != right->umockcall_data_are_equal)
{
/* Codes_SRS_UMOCKCALL_01_014: [ If the two calls have different are_equal functions that have been passed to umockcall_create then the calls shall be considered different and 0 shall be returned. ] */
result = 0;
}
else if (strcmp(left->function_name, right->function_name) != 0)
{
/* Codes_SRS_UMOCKCALL_01_025: [ If the function name does not match for the 2 calls, umockcall_are_equal shall return 0. ]*/
result = 0;
}
else
{
/* Codes_SRS_UMOCKCALL_01_026: [ The call data shall be evaluated by calling the umockcall_data_are_equal function passed in umockcall_create while passing as arguments the umockcall_data associated with each call handle. ]*/
switch (left->umockcall_data_are_equal(left->umockcall_data, right->umockcall_data))
{
default:
/* Codes_SRS_UMOCKCALL_01_029: [ If the underlying umockcall_data_are_equal fails (returns anything else than 0 or 1), then umockcall_are_equal shall fail and return -1. ] */
UMOCK_LOG("umockcall: comparing call data failed.");
result = -1;
break;
case 1:
/* Codes_SRS_UMOCKCALL_01_027: [ If the underlying umockcall_data_are_equal returns 1, then umockcall_are_equal shall return 1. ]*/
result = 1;
break;
case 0:
/* Codes_SRS_UMOCKCALL_01_028: [ If the underlying umockcall_data_are_equal returns 0, then umockcall_are_equal shall return 0. ]*/
result = 0;
break;
}
}
}
return result;
}