summaryrefslogtreecommitdiff
path: root/tests/virbitmaptest.c
diff options
context:
space:
mode:
authorMarc Hartmayer <mhartmay@linux.vnet.ibm.com>2016-07-06 14:02:28 +0200
committerMichal Privoznik <mprivozn@redhat.com>2016-07-09 11:03:32 +0200
commit1edf20a9f87eb5873394182f470e191a9c70f9cf (patch)
tree29fcf40851a3256472444d2ca362055eeccfcf01 /tests/virbitmaptest.c
parentbd125c28b7a9e0ae58c0f34cb33e9dafa7fa664f (diff)
downloadlibvirt-1edf20a9f87eb5873394182f470e191a9c70f9cf.tar.gz
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>
Diffstat (limited to 'tests/virbitmaptest.c')
-rw-r--r--tests/virbitmaptest.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/virbitmaptest.c b/tests/virbitmaptest.c
index 009fa0dad3..a17ef82fb8 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);