3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-25 16:42:37 +01:00

unit: Add M4 builder test

This commit is contained in:
Denis Kenzior 2016-08-19 15:25:05 -05:00
parent 9c457de8d5
commit 76e1c73fd3

View File

@ -1166,6 +1166,22 @@ static void wsc_test_parse_m4(const void *data)
encrypted.iov_base, encrypted.iov_len));
}
static void wsc_test_build_m4(const void *data)
{
const struct m4_data *test = data;
uint8_t *out;
size_t out_len;
out = wsc_build_m4(&test->expected, test->expected_encrypted,
test->expected_encrypted_size, &out_len);
assert(out);
assert(out_len == test->len);
assert(!memcmp(test->pdu, out, test->len));
l_free(out);
}
int main(int argc, char *argv[])
{
l_test_init(&argc, &argv);
@ -1209,6 +1225,7 @@ int main(int argc, char *argv[])
l_test_add("/wsc/build/m3 1", wsc_test_build_m3, &m3_data_1);
l_test_add("/wsc/parse/m4 1", wsc_test_parse_m4, &m4_data_1);
l_test_add("/wsc/build/m4 1", wsc_test_build_m4, &m4_data_1);
return l_test_run();
}