3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-24 15:22:34 +01:00

unit: Add build_probe_request unit test

This commit is contained in:
Denis Kenzior 2015-09-09 09:32:12 -05:00
parent c23b1e3bc0
commit 9d79ce45e4

View File

@ -369,6 +369,20 @@ static void wsc_test_parse_probe_request(const void *data)
probe_request.requested_device_type.subcategory); probe_request.requested_device_type.subcategory);
} }
static void wsc_test_build_probe_request(const void *data)
{
const struct probe_request_data *test = data;
uint8_t *pr;
size_t prlen;
pr = wsc_build_probe_request(&test->expected, &prlen);
assert(pr);
assert(!memcmp(test->pdu, pr, test->len));
l_free(pr);
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
l_test_init(&argc, &argv); l_test_init(&argc, &argv);
@ -383,5 +397,9 @@ int main(int argc, char *argv[])
l_test_add("/wsc/parse/probe request 1", wsc_test_parse_probe_request, l_test_add("/wsc/parse/probe request 1", wsc_test_parse_probe_request,
&probe_request_data_1); &probe_request_data_1);
l_test_add("/wsc/build/probe request 1", wsc_test_build_probe_request,
&probe_request_data_1);
return l_test_run(); return l_test_run();
} }