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(a)linux.vnet.ibm.com>
Reviewed-by: Sascha Silbe <silbe(a)linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy(a)linux.vnet.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay(a)linux.vnet.ibm.com>
---
tests/virbitmaptest.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/tests/virbitmaptest.c b/tests/virbitmaptest.c
index 009fa0d..a17ef82 100644
--- a/tests/virbitmaptest.c
+++ b/tests/virbitmaptest.c
@@ -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);
--
2.5.5