mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
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: Sascha Silbe <silbe@linux.vnet.ibm.com> Reviewed-by: Sascha Silbe <silbe@linux.vnet.ibm.com> Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
This commit is contained in:
parent
bd125c28b7
commit
1edf20a9f8
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user