void confirm_order(queue* q, queue_element** expected, char* location, int* errors) { order expected_order; expected_order.index = 0; expected_order.expected = expected; expected_order.location = location; expected_order.errors = errors; if (*errors > 0) printf("\n"); // Adds new line between each set queue_apply(q, confirm_order_fn, &expected_order); }
int append_apply_test(){ queue* q = queue_create(); int x = 0; int y = 1; int z = 2; queue_append(q, &x); queue_append(q, &y); queue_append(q, &z); queue_append(q, &x); printf("Queue size is %zu\n", queue_size(q)); int index = 0; queue_apply(q, show_one, &index); queue_destroy(q,false); return 0; }
size_t queue_size(queue* q) { size_t count = 0; queue_apply(q, queue_count_one, &count); return count; }
int queue_size(queue_t q) { int sz = 0; queue_apply(q, queue_count_one, &sz); return sz; }