[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 05/12] test-qht: test deletion of the last entry
From: |
Emilio G. Cota |
Subject: |
[Qemu-devel] [PATCH v2 05/12] test-qht: test deletion of the last entry in a bucket |
Date: |
Mon, 10 Sep 2018 14:58:52 -0400 |
This improves coverage by one (!) LoC in qht.c, bringing the
coverage rate up from 90.00% to 90.28%.
Reviewed-by: Alex Bennée <address@hidden>
Signed-off-by: Emilio G. Cota <address@hidden>
---
tests/test-qht.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/tests/test-qht.c b/tests/test-qht.c
index 05b1d6807a..77666e8c5f 100644
--- a/tests/test-qht.c
+++ b/tests/test-qht.c
@@ -172,9 +172,20 @@ static void qht_do_test(unsigned int mode, size_t
init_entries)
qht_init(&ht, is_equal, 0, mode);
rm_nonexist(0, 4);
+ /*
+ * Test that we successfully delete the last element in a bucket.
+ * This is a hard-to-reach code path when resizing is on, but without
+ * resizing we can easily hit it if init_entries <= 1.
+ * Given that the number of elements per bucket can be 4 or 6 depending on
+ * the host's pointer size, test the removal of the 4th and 6th elements.
+ */
insert(0, 4);
rm_nonexist(5, 6);
- insert(4, 6);
+ rm(3, 4);
+ check_n(3);
+ insert(3, 6);
+ rm(5, 6);
+ check_n(5);
rm_nonexist(7, 8);
iter_rm_mod(1);
--
2.17.1
- [Qemu-devel] [PATCH v2 00/12] qht improvements for 3.1, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 02/12] qht: add qht_iter_remove, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 01/12] qht: remove unused map param from qht_remove__locked, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 08/12] qht: fix comment in qht_bucket_remove_entry, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 10/12] qht: constify qht_statistics_init, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 04/12] test-qht: test removal of non-existent entries, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 11/12] qht: constify arguments to some internal functions, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 03/12] test-qht: test qht_iter_remove, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 09/12] qht: constify qht_lookup, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 05/12] test-qht: test deletion of the last entry in a bucket,
Emilio G. Cota <=
- [Qemu-devel] [PATCH v2 06/12] test-qht: speed up + test qht_resize, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 07/12] qht: drop ht argument from qht iterators, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 12/12] qht-bench: add -p flag to precompute hash values, Emilio G. Cota, 2018/09/10
- Re: [Qemu-devel] [PATCH v2 00/12] qht improvements for 3.1, Richard Henderson, 2018/09/12