tests: More ieee802_11_vendor_ie_concat() coverage

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2016-12-26 14:44:44 +02:00
parent b6437fa54b
commit 946315f172

View File

@ -84,6 +84,7 @@ static const struct ieee802_11_parse_test_data parse_tests[] = {
static int ieee802_11_parse_tests(void) static int ieee802_11_parse_tests(void)
{ {
int i, ret = 0; int i, ret = 0;
struct wpabuf *buf;
wpa_printf(MSG_INFO, "ieee802_11_parse tests"); wpa_printf(MSG_INFO, "ieee802_11_parse tests");
@ -109,6 +110,35 @@ static int ieee802_11_parse_tests(void)
ret = -1; ret = -1;
} }
buf = ieee802_11_vendor_ie_concat((const u8 *) "\xdd\x05\x11\x22\x33\x44\x01\xdd\x05\x11\x22\x33\x44\x02\x00\x01",
16, 0x11223344);
do {
const u8 *pos;
if (!buf) {
wpa_printf(MSG_ERROR,
"ieee802_11_vendor_ie_concat test 2 failed");
ret = -1;
break;
}
if (wpabuf_len(buf) != 2) {
wpa_printf(MSG_ERROR,
"ieee802_11_vendor_ie_concat test 3 failed");
ret = -1;
break;
}
pos = wpabuf_head(buf);
if (pos[0] != 0x01 || pos[1] != 0x02) {
wpa_printf(MSG_ERROR,
"ieee802_11_vendor_ie_concat test 3 failed");
ret = -1;
break;
}
} while (0);
wpabuf_free(buf);
return ret; return ret;
} }