提交 1edf20a9 编写于 作者: M Marc Hartmayer 提交者: Michal Privoznik

tests: Add test cases for the empty bitmap

As the empty bitmap exists, we should also test it. This patch adds
test cases for the procedures 'virBitmapNextSetBit', 'virBitmapLastSetBit',
'virBitmapNextClearBit'.
Tested-by: NSascha Silbe <silbe@linux.vnet.ibm.com>
Reviewed-by: NSascha Silbe <silbe@linux.vnet.ibm.com>
Reviewed-by: NBoris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: NMarc Hartmayer <mhartmay@linux.vnet.ibm.com>
上级 bd125c28
......@@ -191,6 +191,23 @@ test4(const void *data ATTRIBUTE_UNUSED)
if (ARRAY_CARDINALITY(bitsPos) + ARRAY_CARDINALITY(bitsPosInv) != size)
goto error;
/* 0. empty set */
if (!(bitmap = virBitmapNewEmpty()))
goto error;
if (virBitmapNextSetBit(bitmap, -1) != -1)
goto error;
if (virBitmapLastSetBit(bitmap) != -1)
goto error;
if (virBitmapNextClearBit(bitmap, -1) != -1)
goto error;
virBitmapFree(bitmap);
bitmap = NULL;
/* 1. zero set */
bitmap = virBitmapNew(size);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册