[PATCH 3/3] tests: Add test cases for the empty bitmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Sascha Silbe <silbe@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]