for nfct_bitmask_clear() and nfct_bitmask_equal() Signed-off-by: Ken-ichirou MATSUZAWA <chamas@xxxxxxxxxxxxx> --- qa/test_api.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/qa/test_api.c b/qa/test_api.c index f17db31..fe1cb78 100644 --- a/qa/test_api.c +++ b/qa/test_api.c @@ -80,6 +80,43 @@ static void test_nfct_bitmask(void) assert(!nfct_bitmask_test_bit(b, i)); } + /* nfct_bitmask_clear() */ + for (i = 0; i < maxb; i++) { + nfct_bitmask_set_bit(b, i); + assert(nfct_bitmask_test_bit(b, i)); + nfct_bitmask_clear(b); + assert(!nfct_bitmask_test_bit(b, i)); + } + + for (i = 0; i < maxb; i++) + nfct_bitmask_set_bit(b, i); + nfct_bitmask_clear(b); + for (i = 0; i < maxb; i++) + assert(!nfct_bitmask_test_bit(b, i)); + + /* nfct_bitmask_equal() */ + for (i = 0; i < maxb / 32 * 32; i += 32) { + a = nfct_bitmask_new(i); + assert(!nfct_bitmask_equal(a, b)); + nfct_bitmask_destroy(a); + } + + a = nfct_bitmask_clone(b); + assert(nfct_bitmask_equal(a, b)); + for (i = 0; i < maxb; i++) { + if (nfct_bitmask_test_bit(a, i)) { + nfct_bitmask_unset_bit(a, i); + assert(!nfct_bitmask_equal(a, b)); + nfct_bitmask_set_bit(a, i); + } else { + nfct_bitmask_set_bit(a, i); + assert(!nfct_bitmask_equal(a, b)); + nfct_bitmask_unset_bit(a, i); + } + assert(nfct_bitmask_equal(a, b)); + } + + nfct_bitmask_destroy(a); nfct_bitmask_destroy(b); ct1 = nfct_new(); -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html