int umocktypes_are_equal_charptr()

in src/umocktypes_charptr.c [57:89]


int umocktypes_are_equal_charptr(const char** left, const char** right)
{
    int result;

    if (
        /* Codes_SRS_UMOCKTYPES_CHARPTR_42_001: [ If left is NULL, umocktypes_are_equal_charptr shall return -1. ]*/
        (left == NULL) ||
        /* Codes_SRS_UMOCKTYPES_CHARPTR_42_002: [ If right is NULL, umocktypes_are_equal_charptr shall return -1. ]*/
        (right == NULL))
    {
        UMOCK_LOG("umocktypes_are_equal_charptr: Bad arguments:left = %p, right = %p.", left, right);
        result = -1;
    }
    else if (*left == *right)
    {
        /* Codes_SRS_UMOCKTYPES_CHARPTR_01_007: [ If left and right are equal, umocktypes_are_equal_charptr shall return 1. ]*/
        result = 1;
    }
    else if ((*left == NULL) || (*right == NULL))
    {
        /* Codes_SRS_UMOCKTYPES_CHARPTR_01_008: [ If only one of the left and right argument is NULL, umocktypes_are_equal_charptr shall return 0. ] */
        result = 0;
    }
    else
    {
        /* Codes_SRS_UMOCKTYPES_CHARPTR_01_009: [ If the string pointed to by left is equal to the string pointed to by right, umocktypes_are_equal_charptr shall return 1. ]*/
        /* Codes_SRS_UMOCKTYPES_CHARPTR_01_010: [ If the string pointed to by left is different than the string pointed to by right, umocktypes_are_equal_charptr shall return 0. ]*/
        /* Codes_SRS_UMOCKTYPES_CHARPTR_01_006: [ The comparison shall be case sensitive. ]*/
        result = (strcmp(*left, *right) == 0) ? 1 : 0;
    }

    return result;
}