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
1 changed files with 17 additions and 0 deletions

View File

@ -1609,6 +1609,22 @@ static void wsc_test_parse_m7(const void *data)
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[] = {
0x01, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x05, 0x01
};
@ -1846,6 +1862,7 @@ int main(int argc, char *argv[])
&m6_encrypted_settings_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",
wsc_test_pbc_handshake, NULL);