-
Notifications
You must be signed in to change notification settings - Fork 5
/
test_queue_speed.c
40 lines (30 loc) · 916 Bytes
/
test_queue_speed.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <core/structures/queue.h>
#include "test.h"
int main(int argc, char **argv)
{
BEGIN_TESTS();
{
struct core_queue queue;
int i;
int value;
core_queue_init(&queue, sizeof(int));
i = 300000000;
while (i--) {
value = i;
core_queue_enqueue(&queue, &value);
core_queue_enqueue(&queue, &value);
core_queue_dequeue(&queue, &value);
core_queue_enqueue(&queue, &value);
core_queue_enqueue(&queue, &value);
core_queue_dequeue(&queue, &value);
core_queue_enqueue(&queue, &value);
core_queue_enqueue(&queue, &value);
core_queue_enqueue(&queue, &value);
core_queue_dequeue(&queue, &value);
core_queue_dequeue(&queue, &value);
}
core_queue_destroy(&queue);
}
END_TESTS();
return 0;
}