]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Increase bitfield module test coverage
authorJouni Malinen <j@w1.fi>
Sat, 28 Feb 2015 09:46:29 +0000 (11:46 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 28 Feb 2015 09:46:29 +0000 (11:46 +0200)
Signed-off-by: Jouni Malinen <j@w1.fi>
src/utils/utils_module_tests.c

index 4227bf4888e224dfb15f65e76d75fc09870d1eb2..b104585c341f0640beb09112d172b7d2b2fcf28e 100644 (file)
@@ -168,6 +168,17 @@ static int bitfield_tests(void)
 
        bitfield_free(bf);
 
+       bf = bitfield_alloc(8);
+       if (bf == NULL)
+               return -1;
+       if (bitfield_get_first_zero(bf) != 0)
+               errors++;
+       for (i = 0; i < 8; i++)
+               bitfield_set(bf, i);
+       if (bitfield_get_first_zero(bf) != -1)
+               errors++;
+       bitfield_free(bf);
+
        if (errors) {
                wpa_printf(MSG_ERROR, "%d bitfield test(s) failed", errors);
                return -1;