Blender  V3.3
Macros | Functions
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 (unsigned int 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 5 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(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:1097
unsigned int BLI_ghash_len(const GHash *gh) ATTR_WARN_UNUSED_RESULT
Definition: BLI_ghash.c:705

Definition at line 14 of file BLI_ghash_test.cc.

◆ TESTCASE_SIZE

#define TESTCASE_SIZE   10000

Definition at line 11 of file BLI_ghash_test.cc.

Function Documentation

◆ init_keys()

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

Definition at line 37 of file BLI_ghash_test.cc.

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

Referenced by TEST().

◆ TEST() [1/5]

TEST ( ghash  ,
Copy   
)

◆ TEST() [2/5]

TEST ( ghash  ,
InsertLookup   
)

◆ TEST() [3/5]

TEST ( ghash  ,
InsertRemove   
)

◆ TEST() [4/5]

TEST ( ghash  ,
InsertRemoveShrink   
)

◆ TEST() [5/5]

TEST ( ghash  ,
Pop   
)