Debian Codegraph @

test/unit/test-circular-queue.c

raw
1 #ifdef HAVE_CONFIG_H
2 #include "config.h"
3 #endif
4
5 #include <stdarg.h>
6 #include <stdbool.h>
7 #include <stddef.h>
8 #include <stdint.h>
9 #include <setjmp.h>
10 #include <cmocka.h>
11
12 #include "aircrack-ng/adt/circular_queue.h"
13
14 static void test_cqueue_init_and_empty(void ** state)
15 {
16 (void) state;
17
18 // GIVEN
19 #define size 64
20 uint8_t buffer[size];
21
22 // WHEN
23 cqueue_handle_t cq = circular_queue_init(buffer, size, 1);
24
25 // THEN
26 assert_non_null(cq);
27 assert_true(circular_queue_is_empty(cq));
28 assert_false(circular_queue_is_full(cq));
29
30 // END
31 #undef size
32 circular_queue_free(cq);
33 }
34
35 int main(int argc, char * argv[])
36 {
37 (void) argc;
38 (void) argv;
39
40 const struct CMUnitTest tests[] = {
41 cmocka_unit_test(test_cqueue_init_and_empty),
42 };
43 return cmocka_run_group_tests(tests, NULL, NULL);
44 }