diff options
author | Marc <foxtrot@malloc.me> | 2022-01-09 15:21:47 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-09 15:21:47 +0000 |
commit | 0bd924735125b34b74c893936b89cfae02e3379d (patch) | |
tree | c8140bf65c24791874fa9b0e194773178a34da83 /test/src/atim_tests.c | |
parent | 8e09d29df19312583747a3de00fe4269c17e6586 (diff) | |
parent | 11c7393bebe4df6e2061f69787f4a7dd5c31f077 (diff) | |
download | libwifi-0bd924735125b34b74c893936b89cfae02e3379d.tar.gz libwifi-0bd924735125b34b74c893936b89cfae02e3379d.tar.bz2 libwifi-0bd924735125b34b74c893936b89cfae02e3379d.zip |
Merge pull request #3 from libwifi/test
test: Add ctests for parse and generate functions.
Diffstat (limited to 'test/src/atim_tests.c')
-rw-r--r-- | test/src/atim_tests.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/src/atim_tests.c b/test/src/atim_tests.c new file mode 100644 index 0000000..43f2265 --- /dev/null +++ b/test/src/atim_tests.c | |||
@@ -0,0 +1,35 @@ | |||
1 | #include "../../src/libwifi.h" | ||
2 | |||
3 | #include <errno.h> | ||
4 | #include <stdio.h> | ||
5 | #include <string.h> | ||
6 | |||
7 | #define BCAST_MAC "\xff\xff\xff\xff\xff\xff" | ||
8 | #define TO_MAC "\x00\x20\x91\xAA\xBB\xCC" | ||
9 | const unsigned char to[] = TO_MAC; | ||
10 | const unsigned char bcast[] = BCAST_MAC; | ||
11 | |||
12 | int test_atim_gen_full() { | ||
13 | struct libwifi_atim atim = {0}; | ||
14 | |||
15 | int ret = libwifi_create_atim(&atim, bcast, to, to); | ||
16 | if (ret != 0) { | ||
17 | fprintf(stderr, "Failed to create atim: %s\n", strerror(ret)); | ||
18 | return ret; | ||
19 | } | ||
20 | |||
21 | return 0; | ||
22 | } | ||
23 | |||
24 | int main(int argc, char **argv) { | ||
25 | if (argc < 2) { | ||
26 | printf("Specify test\n"); | ||
27 | return -1; | ||
28 | } | ||
29 | |||
30 | if (strcmp(argv[1], "--atim-gen-full") == 0) { | ||
31 | return test_atim_gen_full(); | ||
32 | } | ||
33 | |||
34 | return -1; | ||
35 | } | ||