public inbox for [email protected]
help / color / mirror / Atom feedFrom: David Rowley <[email protected]>
To: Daniel Gustafsson <[email protected]>
Cc: Michael Paquier <[email protected]>
Cc: Greg Burd <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: [PATCH] Add tests for Bitmapset
Date: Fri, 3 Oct 2025 12:36:57 +1300
Message-ID: <CAApHDvqiN0+mbooUOSCDALc=GoM8DmTbCdvwnCwak6Wb2O1ZJA@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAApHDvq-4994jpDnspQ+bgSbzo0+=Z4YQbj+YfP7wi97B0e1qg@mail.gmail.com>
<[email protected]>
<CAApHDvrvixMmscGEfEyYz0=qbwzM7Y0Up-Uh_AKVmfn8K2sn_A@mail.gmail.com>
<[email protected]>
<CAApHDvoC-W3s2QJdBY6B32BXy2br9iGsNJ3v4uLFOosBgmY2YA@mail.gmail.com>
<[email protected]>
<CAApHDvrEPw6DAQdZg7u1YknVvN1Gy38kUURQm8bOHSKU2cw+4w@mail.gmail.com>
<[email protected]>
<[email protected]>
<CAApHDvpYkS+=KPcCvYOF4Za9=a_D94Gd9x1oCzuz97He1_T0Pw@mail.gmail.com>
<[email protected]>
On Fri, 3 Oct 2025 at 01:33, Daniel Gustafsson <[email protected]> wrote:
> Another nitpick would be to remove the test for NULL in test_bms_make_singleton
> since that is a STRICT function, making the test for NULL superfluous code:
I see test_random_operations() is also strict. Is it worth getting rid
of the SQL NULL checks on the inputs there too? Aka, the attached.
David
Attachments:
[application/octet-stream] test_random_operations_is_strict_no_need_to_check_for_null_inputs.patch (1.5K, 2-test_random_operations_is_strict_no_need_to_check_for_null_inputs.patch)
download | inline diff:
diff --git a/src/test/modules/test_bitmapset/test_bitmapset.c b/src/test/modules/test_bitmapset/test_bitmapset.c
index acaa93d2f11..8bc9b1f48e9 100644
--- a/src/test/modules/test_bitmapset/test_bitmapset.c
+++ b/src/test/modules/test_bitmapset/test_bitmapset.c
@@ -587,7 +587,7 @@ test_bitmap_match(PG_FUNCTION_ARGS)
* "min_value" is the minimal value used for the members, that will stand
* up to a range of "max_range". "num_ops" defines the number of time each
* operation is done. "seed" is a random seed used to calculate the member
- * values.
+ * values. When "seed" is <= 0, a random seed will be chosen automatically.
*
* The return value is the number of times all operations have been executed.
*/
@@ -600,25 +600,20 @@ test_random_operations(PG_FUNCTION_ARGS)
Bitmapset *result = NULL;
pg_prng_state state;
uint64 seed = GetCurrentTimestamp();
- int num_ops = 5000;
- int total_ops = 0;
- int max_range = 2000;
- int min_value = 0;
+ int num_ops;
+ int max_range;
+ int min_value;
int member;
int *members;
int num_members = 0;
+ int total_ops = 0;
- if (!PG_ARGISNULL(0) && PG_GETARG_INT32(0) > 0)
+ if (PG_GETARG_INT32(0) > 0)
seed = PG_GETARG_INT32(0);
- if (!PG_ARGISNULL(1))
- num_ops = PG_GETARG_INT32(1);
-
- if (!PG_ARGISNULL(2))
- max_range = PG_GETARG_INT32(2);
-
- if (!PG_ARGISNULL(3))
- min_value = PG_GETARG_INT32(3);
+ num_ops = PG_GETARG_INT32(1);
+ max_range = PG_GETARG_INT32(2);
+ min_value = PG_GETARG_INT32(3);
pg_prng_seed(&state, seed);
members = palloc(sizeof(int) * num_ops);
view thread (81+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: [PATCH] Add tests for Bitmapset
In-Reply-To: <CAApHDvqiN0+mbooUOSCDALc=GoM8DmTbCdvwnCwak6Wb2O1ZJA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox