25#define EXPECT_TRUE(expr) \
29 "%s was unexpectedly false in file \"%s\" line %u", \
30 #expr, __FILE__, __LINE__); \
33#define EXPECT_FALSE(expr) \
37 "%s was unexpectedly true in file \"%s\" line %u", \
38 #expr, __FILE__, __LINE__); \
41#define EXPECT_EQ_U64(result_expr, expected_expr) \
43 uint64 _result = (result_expr); \
44 uint64 _expected = (expected_expr); \
45 if (_result != _expected) \
47 "%s yielded %" PRIx64 ", expected %" PRIx64 " (%s) in file \"%s\" line %u", \
48 #result_expr, _result, _expected, #expected_expr, __FILE__, __LINE__); \
75 .class_name =
"node-16-lo",
79 .class_name =
"node-16-hi",
83 .class_name =
"node-48",
87 .class_name =
"node-256",
99#define RT_VALUE_TYPE TestValueType
113 return tree->ctl->num_keys;
183 elog(
NOTICE,
"testing node %s with shift %d and %s keys",
184 test_info->class_name, shift,
asc ?
"ascending" :
"descending");
187 for (
int i = 0;
i < children;
i++)
192 keys[
i] = (
uint64) (children - 1 -
i) << shift;
199 for (
int i = 0;
i < children;
i++)
205 for (
int i = 0;
i < children;
i++)
217 for (
int i = 0;
i < children;
i++)
226 for (
int i = 0;
i < children;
i++)
233 for (
int i = 0;
i < children;
i++)
247 for (
int i = 0;
i < children;
i++)
269 for (
int i = 0;
i < children;
i++)
273 for (
int i = 0;
i < children;
i++)
300 uint64 filter = ((
uint64) (0x07 << 24) | (0xFF << 16) | 0xFF);
302 int num_keys = 100000;
351 for (
uint64 i = 0;
i < num_keys - 1;
i++)
356 if (keys[
i + 1] == keys[
i] || keys[
i + 1] == keys[
i] + 1)
365 for (
uint64 key = 0; key < keys[0]; key++)
389 for (
int i = 0;
i < num_keys;
i++)
396 if (
i < num_keys - 1 && keys[
i + 1] == keys[
i])
TimestampTz GetCurrentTimestamp(void)
void dsa_detach(dsa_area *area)
#define dsa_create(tranche_id)
#define palloc_array(type, count)
#define PG_FUNCTION_INFO_V1(funcname)
static int pg_cmp_u64(uint64 a, uint64 b)
int LWLockNewTrancheId(const char *name)
void pfree(void *pointer)
MemoryContext CurrentMemoryContext
#define AllocSetContextCreate
#define SLAB_DEFAULT_BLOCK_SIZE
#define ALLOCSET_SMALL_SIZES
uint64 pg_prng_uint64(pg_prng_state *state)
void pg_prng_seed(pg_prng_state *state, uint64 seed)
#define qsort(a, b, c, d)
MemoryContext SlabContextCreate(MemoryContext parent, const char *name, Size blockSize, Size chunkSize)
#define EXPECT_TRUE(expr)
static uint64 rt_num_entries(rt_radix_tree *tree)
#define EXPECT_FALSE(expr)
#define EXPECT_EQ_U64(result_expr, expected_expr)
static void test_random(void)
Datum test_radixtree(PG_FUNCTION_ARGS)
static void test_empty(void)
static void test_basic(rt_node_class_test_elem *test_info, int shift, bool asc)
static int key_cmp(const void *a, const void *b)
static rt_node_class_test_elem rt_node_class_tests[]