Blender V4.3
BLI_ghash_test.cc File Reference
#include "testing/testing.h"
#include "BLI_ghash.h"
#include "BLI_rand.h"
#include "BLI_utildefines.h"

Go to the source code of this file.

Macros

#define GHASH_INTERNAL_API
 
#define TESTCASE_SIZE   10000
 
#define PRINTF_GHASH_STATS(_gh)
 

Functions

static void init_keys (uint keys[TESTCASE_SIZE], const int seed)
 
 TEST (ghash, InsertLookup)
 
 TEST (ghash, InsertRemove)
 
 TEST (ghash, InsertRemoveShrink)
 
 TEST (ghash, Copy)
 
 TEST (ghash, Pop)
 

Macro Definition Documentation

◆ GHASH_INTERNAL_API

#define GHASH_INTERNAL_API

Definition at line 7 of file BLI_ghash_test.cc.

◆ PRINTF_GHASH_STATS

#define PRINTF_GHASH_STATS ( _gh)
Value:
{ \
double q, lf, var, pempty, poverloaded; \
int bigb; \
q = BLI_ghash_calc_quality_ex((_gh), &lf, &var, &pempty, &poverloaded, &bigb); \
printf( \
"GHash stats (%d entries):\n\t" \
"Quality (the lower the better): %f\n\tVariance (the lower the better): %f\n\tLoad: " \
"%f\n\t" \
"Empty buckets: %.2f%%\n\tOverloaded buckets: %.2f%% (biggest bucket: %d)\n", \
BLI_ghash_len(_gh), \
q, \
var, \
lf, \
pempty * 100.0, \
poverloaded * 100.0, \
bigb); \
} \
void(0)
double BLI_ghash_calc_quality_ex(const GHash *gh, double *r_load, double *r_variance, double *r_prop_empty_buckets, double *r_prop_overloaded_buckets, int *r_biggest_bucket)
Definition BLI_ghash.c:1092
unsigned int BLI_ghash_len(const GHash *gh) ATTR_WARN_UNUSED_RESULT
Definition BLI_ghash.c:702

Definition at line 16 of file BLI_ghash_test.cc.

◆ TESTCASE_SIZE

#define TESTCASE_SIZE   10000

Definition at line 13 of file BLI_ghash_test.cc.

Referenced by init_keys(), TEST(), TEST(), TEST(), TEST(), and TEST().

Function Documentation

◆ init_keys()

static void init_keys ( uint keys[TESTCASE_SIZE],
const int seed )
static

Definition at line 39 of file BLI_ghash_test.cc.

References BLI_rng_free(), BLI_rng_get_uint(), BLI_rng_new(), seed, and TESTCASE_SIZE.

Referenced by TEST(), TEST(), TEST(), TEST(), and TEST().

◆ TEST() [1/5]

◆ TEST() [2/5]

◆ TEST() [3/5]

◆ TEST() [4/5]

◆ TEST() [5/5]