mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 06:29:23 +01:00
unit: Add ie RSNE Builder test
This particular set of tests makes sure we can build the compact forms of RSNE. The test data are the most compact versions of the RSNE IE examples found in 802.11, Section 8.4.2.27.1
This commit is contained in:
parent
fc60014d47
commit
bcedd58249
@ -415,6 +415,22 @@ static void ie_test_rsne_info(const void *data)
|
|||||||
assert(test->group_management_cipher == info.group_management_cipher);
|
assert(test->group_management_cipher == info.group_management_cipher);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ie_test_rsne_build_compact_info(const void *data)
|
||||||
|
{
|
||||||
|
const struct ie_rsne_info_test *test = data;
|
||||||
|
int r;
|
||||||
|
struct ie_rsn_info info;
|
||||||
|
uint8_t buf[256];
|
||||||
|
|
||||||
|
r = ie_parse_rsne_from_data(test->data, test->data_len, &info);
|
||||||
|
assert(r == 0);
|
||||||
|
|
||||||
|
r = ie_build_rsne(&info, buf);
|
||||||
|
assert(r);
|
||||||
|
|
||||||
|
assert(!memcmp(test->data, buf, test->data_len));
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
l_test_init(&argc, &argv);
|
l_test_init(&argc, &argv);
|
||||||
@ -439,5 +455,15 @@ int main(int argc, char *argv[])
|
|||||||
l_test_add("/ie/RSN Info Parser/Test Case 6",
|
l_test_add("/ie/RSN Info Parser/Test Case 6",
|
||||||
ie_test_rsne_info, &ie_rsne_info_test_6);
|
ie_test_rsne_info, &ie_rsne_info_test_6);
|
||||||
|
|
||||||
|
l_test_add("/ie/RSN Info Builder/Compact Test 1",
|
||||||
|
ie_test_rsne_build_compact_info,
|
||||||
|
&ie_rsne_info_test_3);
|
||||||
|
l_test_add("/ie/RSN Info Builder/Compact Test 2",
|
||||||
|
ie_test_rsne_build_compact_info,
|
||||||
|
&ie_rsne_info_test_4);
|
||||||
|
l_test_add("/ie/RSN Info Builder/Compact Test 3",
|
||||||
|
ie_test_rsne_build_compact_info,
|
||||||
|
&ie_rsne_info_test_5);
|
||||||
|
|
||||||
return l_test_run();
|
return l_test_run();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user