3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-20 19:12:33 +01:00

unit: Add test for wsc_build_m7

This commit is contained in:
Denis Kenzior 2016-08-31 11:38:35 -05:00
parent 82b007f7b5
commit 9353da8bf3

View File

@ -1609,6 +1609,22 @@ static void wsc_test_parse_m7(const void *data)
encrypted.iov_base, encrypted.iov_len)); encrypted.iov_base, encrypted.iov_len));
} }
static void wsc_test_build_m7(const void *data)
{
const struct m7_data *test = data;
uint8_t *out;
size_t out_len;
out = wsc_build_m7(&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);
}
static const uint8_t eap_identity_req[] = { static const uint8_t eap_identity_req[] = {
0x01, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x05, 0x01 0x01, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x05, 0x01
}; };
@ -1846,6 +1862,7 @@ int main(int argc, char *argv[])
&m6_encrypted_settings_data_1); &m6_encrypted_settings_data_1);
l_test_add("/wsc/parse/m7 1", wsc_test_parse_m7, &m7_data_1); l_test_add("/wsc/parse/m7 1", wsc_test_parse_m7, &m7_data_1);
l_test_add("/wsc/build/m7 1", wsc_test_build_m7, &m7_data_1);
l_test_add("/wsc/handshake/PBC Handshake Test", l_test_add("/wsc/handshake/PBC Handshake Test",
wsc_test_pbc_handshake, NULL); wsc_test_pbc_handshake, NULL);