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

unit: Add sanity check for wsc_pin_is_checksum_valid

This commit is contained in:
Denis Kenzior 2017-02-13 20:27:49 -06:00
parent 94c49a4563
commit 40013e9981

View File

@ -2178,6 +2178,13 @@ static void wsc_test_pin_valid(const void *data)
assert(!wsc_pin_is_valid("abcdefgh")); assert(!wsc_pin_is_valid("abcdefgh"));
} }
static void wsc_test_pin_checksum(const void *data)
{
assert(!wsc_pin_is_checksum_valid("12345671"));
assert(wsc_pin_is_checksum_valid("12345670"));
assert(wsc_pin_is_checksum_valid("24681353"));
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
l_test_init(&argc, &argv); l_test_init(&argc, &argv);
@ -2265,6 +2272,7 @@ int main(int argc, char *argv[])
wsc_test_retransmission_no_fragmentation, NULL); wsc_test_retransmission_no_fragmentation, NULL);
l_test_add("/wsc/pin/valid pin", wsc_test_pin_valid, NULL); l_test_add("/wsc/pin/valid pin", wsc_test_pin_valid, NULL);
l_test_add("/wsc/pin/valid checksum", wsc_test_pin_checksum, NULL);
return l_test_run(); return l_test_run();
} }