aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2021-09-27 12:47:05 +0200
committerLuca Deri <deri@ntop.org>2021-09-27 12:47:05 +0200
commitaf35d6b96365122fcb1474bec800f6c169e36be7 (patch)
tree9c24d62b8f7c9ab008c16f8c53f739ffaf13c522 /example
parentb9ccff0761532b65a26edb1f7ac9f80c3ff58aa1 (diff)
Added unit test for bitmap iteration
Diffstat (limited to 'example')
-rw-r--r--example/ndpiReader.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index 0fb8de437..a88c40eec 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -4368,6 +4368,8 @@ void compressedBitmapUnitTest() {
u_int i, trace = 0;
size_t ser;
char *buf;
+ ndpi_bitmap_iterator *it;
+ u_int32_t value;
for(i=0; i<1000; i++) {
u_int32_t v = rand();
@@ -4385,6 +4387,13 @@ void compressedBitmapUnitTest() {
if(trace) printf("len: %u\n", (unsigned int)ser);
b1 = ndpi_bitmap_deserialize(buf);
assert(b1);
+
+ assert(it = ndpi_bitmap_iterator_alloc(b));
+ while(ndpi_bitmap_iterator_next(it, &value))
+ printf("%u ", value);
+
+ printf("\n");
+ ndpi_bitmap_iterator_free(it);
ndpi_free(buf);
ndpi_bitmap_free(b);