diff options
author | Max Reitz <mreitz@redhat.com> | 2016-11-15 23:57:46 +0100 |
---|---|---|
committer | Fam Zheng <famz@redhat.com> | 2017-01-26 10:25:01 +0800 |
commit | 7cdc49b9a2ee127b2403f6ce98ce3f96afb41733 (patch) | |
tree | 74787c3052205072a4e51d33e76e012a151617e7 | |
parent | 20a579de8484096d18e65751ebe63fee31551f04 (diff) |
test-hbitmap: Add hbitmap_is_serializable() calls
Add calls to hbitmap_is_serializable() (asserting that it returns true)
where necessary (i.e. before every series of (de-)serialization function
invocations).
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20161115225746.3590-3-mreitz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
-rw-r--r-- | tests/test-hbitmap.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test-hbitmap.c b/tests/test-hbitmap.c index 9b7495cc32..23773d2051 100644 --- a/tests/test-hbitmap.c +++ b/tests/test-hbitmap.c @@ -744,6 +744,8 @@ static void test_hbitmap_serialize_granularity(TestHBitmapData *data, int r; hbitmap_test_init(data, L3 * 2, 3); + g_assert(hbitmap_is_serializable(data->hb)); + r = hbitmap_serialization_granularity(data->hb); g_assert_cmpint(r, ==, 64 << 3); } @@ -768,6 +770,8 @@ static void hbitmap_test_serialize_range(TestHBitmapData *data, if (count) { hbitmap_set(data->hb, pos, count); } + + g_assert(hbitmap_is_serializable(data->hb)); hbitmap_serialize_part(data->hb, buf, 0, data->size); /* Serialized buffer is inherently LE, convert it back manually to test */ @@ -788,6 +792,8 @@ static void hbitmap_test_serialize_range(TestHBitmapData *data, memset(buf, 0, buf_size); hbitmap_serialize_part(data->hb, buf, 0, data->size); hbitmap_reset_all(data->hb); + + g_assert(hbitmap_is_serializable(data->hb)); hbitmap_deserialize_part(data->hb, buf, 0, data->size, true); for (i = 0; i < data->size; i++) { @@ -810,6 +816,7 @@ static void test_hbitmap_serialize_basic(TestHBitmapData *data, int num_positions = sizeof(positions) / sizeof(positions[0]); hbitmap_test_init(data, L3, 0); + g_assert(hbitmap_is_serializable(data->hb)); buf_size = hbitmap_serialization_size(data->hb, 0, data->size); buf = g_malloc0(buf_size); @@ -841,6 +848,8 @@ static void test_hbitmap_serialize_part(TestHBitmapData *data, hbitmap_set(data->hb, positions[i], 1); } + g_assert(hbitmap_is_serializable(data->hb)); + for (i = 0; i < data->size; i += buf_size) { unsigned long *el = (unsigned long *)buf; hbitmap_serialize_part(data->hb, buf, i, buf_size); @@ -879,6 +888,8 @@ static void test_hbitmap_serialize_zeroes(TestHBitmapData *data, hbitmap_set(data->hb, positions[i], L1); } + g_assert(hbitmap_is_serializable(data->hb)); + for (i = 0; i < num_positions; i++) { hbitmap_deserialize_zeroes(data->hb, positions[i], min_l1, true); hbitmap_iter_init(&iter, data->hb, 0); |