mirror of
https://github.com/Genymobile/scrcpy
synced 2024-11-17 03:25:38 +00:00
ab912c23e7
This enables necessary functions once for all. As a consequence, define common.h before any other header.
44 lines
778 B
C
44 lines
778 B
C
#include "common.h"
|
|
|
|
#include <assert.h>
|
|
|
|
#include "util/queue.h"
|
|
|
|
struct foo {
|
|
int value;
|
|
struct foo *next;
|
|
};
|
|
|
|
static void test_queue(void) {
|
|
struct my_queue QUEUE(struct foo) queue;
|
|
queue_init(&queue);
|
|
|
|
assert(queue_is_empty(&queue));
|
|
|
|
struct foo v1 = { .value = 42 };
|
|
struct foo v2 = { .value = 27 };
|
|
|
|
queue_push(&queue, next, &v1);
|
|
queue_push(&queue, next, &v2);
|
|
|
|
struct foo *foo;
|
|
|
|
assert(!queue_is_empty(&queue));
|
|
queue_take(&queue, next, &foo);
|
|
assert(foo->value == 42);
|
|
|
|
assert(!queue_is_empty(&queue));
|
|
queue_take(&queue, next, &foo);
|
|
assert(foo->value == 27);
|
|
|
|
assert(queue_is_empty(&queue));
|
|
}
|
|
|
|
int main(int argc, char *argv[]) {
|
|
(void) argc;
|
|
(void) argv;
|
|
|
|
test_queue();
|
|
return 0;
|
|
}
|