From cd1df65dc36ac35d526de195284d5ebf18e1f92b Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 17 Dec 2021 18:52:36 +0000 Subject: test: Add ctests for generation functions. This commit also enforces error code checking on functions inside of the generation functions, such as for `libwifi_quick_add_tag`. --- test/src/atim_tests.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 test/src/atim_tests.c (limited to 'test/src/atim_tests.c') 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 @@ +#include "../../src/libwifi.h" + +#include +#include +#include + +#define BCAST_MAC "\xff\xff\xff\xff\xff\xff" +#define TO_MAC "\x00\x20\x91\xAA\xBB\xCC" +const unsigned char to[] = TO_MAC; +const unsigned char bcast[] = BCAST_MAC; + +int test_atim_gen_full() { + struct libwifi_atim atim = {0}; + + int ret = libwifi_create_atim(&atim, bcast, to, to); + if (ret != 0) { + fprintf(stderr, "Failed to create atim: %s\n", strerror(ret)); + return ret; + } + + return 0; +} + +int main(int argc, char **argv) { + if (argc < 2) { + printf("Specify test\n"); + return -1; + } + + if (strcmp(argv[1], "--atim-gen-full") == 0) { + return test_atim_gen_full(); + } + + return -1; +} -- cgit 1.4.1