samedi 3 février 2018

test empty queue in c

I want to test a function called queue_empty() and check if it actually creates an empty queue or not. Here's the code for the function that is testing the other function:

void create_empty_test()
{

// Creates empty list.  
queue *q=queue_empty(NULL);

    // Verify that list is empty.
    if (????) {
        //error message.
        fprintf(stderr, "FAIL. New queue is not empty!\n");
        // clean up .
        queue_kill(q);
        // Exit with error.
        exit(EXIT_FAILURE);
    }

    // Everything okay
    queue_kill(q);
} 

what should I write where the questionmarks are? Sorry if this question is bad, I am really new to c, queues, lists and pointers etc. I'm thankful for all answers and explanations.

Aucun commentaire:

Enregistrer un commentaire