test_bitmapset: Improve random function
authorMichael Paquier <michael@paquier.xyz>
Thu, 9 Oct 2025 22:20:03 +0000 (07:20 +0900)
committerMichael Paquier <michael@paquier.xyz>
Thu, 9 Oct 2025 22:20:03 +0000 (07:20 +0900)
commit9d46b86529e8337e34fb5a65b1a7dca9dc53938f
tree00594073c403cb2e99aa3e7ef38660c7e91e5320
parentd96f87332b3786abd23cba47459546799c562b8c
test_bitmapset: Improve random function

test_random_operations() did not check the result returned by
bms_is_member() in its last phase, when checking that the contents of
the bitmap match with what is expected.  This was impacting the
reliability of the function and the coverage it could provide.

This commit improves the whole function, adding more checks based on
bms_is_member(), using a bitmap and a secondary array that tracks the
members added by random additions and deletions.

While on it, more comments are added to document the internals of the
function.

Reported-by: Ranier Vilela <ranier.vf@gmail.com>
Author: Greg Burd <greg@burd.me>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAEudQAq_zOSA2NUQSWePTGV_=90Uw0WcXxGOWnN-vwF046OOqA@mail.gmail.com
src/test/modules/test_bitmapset/test_bitmapset.c