1
0
Fork 0

More streamlining of queue.

This commit is contained in:
wael 2022-02-16 17:07:51 +02:00
parent b61eb5a701
commit df26c1cf4b
No known key found for this signature in database
GPG Key ID: C0A5FBF4558963D4
2 changed files with 8 additions and 2 deletions

View File

@ -19,6 +19,13 @@
#ifndef QUEUE_H
#define QUEUE_H
#include "single_linked_list.h"
/* Debug definitions. */
#ifdef DEBUG
#ifndef NDEBUG
#define NDEBUG
#endif /* NDEBUG. */
#endif /* DEBUG. */
#include <assert.h>
/* Constants. */
/* Function error/return code on success. */

View File

@ -197,7 +197,6 @@ int test_queues() {
/* Local variables. */
queue_t *queue;
node_t *node, *tail;
int error;
/* Initialize an empty queue. */
queue = initialize_queue();
@ -217,7 +216,7 @@ int test_queues() {
assert(queue->list->length == QUEUE_LENGTH_ONE);
assert(queue->list->head && queue->list->head == node);
assert(queue->tail && queue->tail == node);
assert(get_node_i_single_linked_list(queue->list, 0, &error) == node);
assert(get_node_i_single_linked_list(queue->list, 0) == node);
assert(get_node_index_pointer_single_linked_list(queue->list, node) == 0);
/* Attempt to free the nodes and then the queue. */