common/tests/test_alloc.c
/* Helper function which tests validity of a data_string
*
* Verifies that the given data_string contains a null-terminated string
* equal to a given string.
*
* \param string data_string to test
* \param src text content string should contain
* \return returns NULL if data_string is validate or an error message
* describing why it is invalid
*/
Helper function which tests validity of a data_string
Verifies that the given data_string contains a null-terminated string
equal to a given string.

\param string data_string to test
\param src text content string should contain
\return returns NULL if data_string is validate or an error message
describing why it is invalid
Helper function which tests validity of a data_string Verifies that the given data_string contains a null - terminated string equal to a given string . \ param string data_string to test \ param src text content string should contain \ return returns NULL if data_string is validate or an error message describing why it is invalid
const char* checkString (struct data_string* string,
    const char* src) {
    int src_len = strlen(src);
    if (string->buffer == NULL) {
        return ("buffer is NULL");
    }
    if (string->data != string->buffer->data) {
        return ("data not set to buffer->data");
    }
    if (string->len != src_len) {
        return ("len is wrong ");
    }
    if (string->terminated != 1)  {
        return ("terminated flag not set");
    }
    if (memcmp(string->data, src, src_len + 1)) {
        return ("data content wrong");
    }
    return (NULL);
}
const char * checkString ( struct data_string * string , const char * src ) { int src_len = strlen ( src ) ; if ( string -> buffer == NULL ) { return ( " " ) ; } if ( string -> data != string -> buffer -> data ) { return ( " " ) ; } if ( string -> len != src_len ) { return ( " " ) ; } if ( string -> terminated != 1 ) { return ( " " ) ; } if ( memcmp ( string -> data , src , src_len + 1 ) ) { return ( " " ) ; } return ( NULL ) ; }
Helper function which tests validity of a data_string
Verifies that the given data_string contains a null-terminated string
equal to a given string.
Helper function which tests validity of a data_string Verifies that the given data_string contains a null - terminated string equal to a given string .