Add a test module for Bitmapset
authorMichael Paquier <michael@paquier.xyz>
Mon, 22 Sep 2025 07:53:00 +0000 (16:53 +0900)
committerMichael Paquier <michael@paquier.xyz>
Mon, 22 Sep 2025 07:53:00 +0000 (16:53 +0900)
commit00c3d87a5cab6e1b816658f15573ea4730c2f17b
tree4c25b4e5e50630c0f87f9440441e0884cfc4ea43
parent9fc7f6ab7226d7c9dbe4ff333130c82f92749f69
Add a test module for Bitmapset

Bitmapset has a complex set of APIs, defined in bitmapset.h, and it can
be hard to test edge cases with the backend core code only.

This test module is aimed at closing the gap, and implements a set of
SQL functions that act as wrappers of the low-level C functions of the
same names.  These functions rely on text as data type for the input and
the output as Bitmapset as a node has support for these.  An extra
function, named test_random_operations(), can be used to stress bitmaps
with random member values and a defined number of operations potentially
useful for other purposes than only tests.

The coverage increases from 85.2% to 93.4%.  It should be possible to
cover more code paths, but at least it's a beginning.

Author: Greg Burd <greg@burd.me>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/7BD1ABDB-B03A-464A-9BA9-A73B55AD8A1F@getmailspring.com
src/test/modules/Makefile
src/test/modules/meson.build
src/test/modules/test_bitmapset/.gitignore [new file with mode: 0644]
src/test/modules/test_bitmapset/Makefile [new file with mode: 0644]
src/test/modules/test_bitmapset/expected/test_bitmapset.out [new file with mode: 0644]
src/test/modules/test_bitmapset/meson.build [new file with mode: 0644]
src/test/modules/test_bitmapset/sql/test_bitmapset.sql [new file with mode: 0644]
src/test/modules/test_bitmapset/test_bitmapset--1.0.sql [new file with mode: 0644]
src/test/modules/test_bitmapset/test_bitmapset.c [new file with mode: 0644]
src/test/modules/test_bitmapset/test_bitmapset.control [new file with mode: 0644]