Alien-Judy

 view release on metacpan or  search on metacpan

src/judy-1.0.5/test/Judy1LCheck.c  view on Meta::CPAN

// @(#) $Revision: 4.15 $ $Source: /judy/test/manual/Judy1LCheck.c $
//      This program tests the accuracy of a Judy1 with a JudyL Array.
//                      -by- 
//      Douglas L. Baskins (8/2001)  doug@sourcejudy.com

#ifndef JU_WIN_IA32
#include <unistd.h>		// unavailable on Win32, and no getopt().
#endif

#include <stdlib.h>		// calloc()
#include <math.h>               // pow()
#include <stdio.h>		// printf()

#include <Judy.h>

// Common macro to handle a failure
#define FAILURE(STR, UL)						\
{									\
printf(         "Error: %s %lu, file='%s', 'function='%s', line %d\n",	\
	STR, UL, __FILE__, __FUNCTI0N__, __LINE__); 			\
fprintf(stderr, "Error: %s %lu, file='%s', 'function='%s', line %d\n",	\
	STR, UL, __FILE__, __FUNCTI0N__, __LINE__); 			\
	exit(1);							\
}

// Structure to keep track of times
typedef struct MEASUREMENTS_STRUCT
{
    Word_t ms_delta;
}
ms_t, *Pms_t;

// Specify prototypes for each test routine
int
NextNumb(Word_t * PNumber, double *PDNumb, double DMult, Word_t MaxNumb);

Word_t TestJudyIns(void **J1, void **JL, Word_t Seed, Word_t Elements);

Word_t TestJudyDup(void **J1, void **JL, Word_t Seed, Word_t Elements);

int TestJudyDel(void **J1, void **JL, Word_t Seed, Word_t Elements);

Word_t TestJudyGet(void *J1, void *JL, Word_t Seed, Word_t Elements);

int TestJudyCount(void *J1, void *JL, Word_t LowIndex, Word_t Elements);

Word_t TestJudyNext(void *J1, void *JL, Word_t LowIndex, Word_t Elements);

int TestJudyPrev(void *J1, void *JL, Word_t HighIndex, Word_t Elements);

int
TestJudyNextEmpty(void *J1, void *JL, Word_t LowIndex, Word_t Elements);

int
TestJudyPrevEmpty(void *J1, void *JL, Word_t HighIndex, Word_t Elements);

Word_t MagicList[] = 
{
    0,0,0,0,0,0,0,0,0,0, // 0..9
    0x27f,      // 10
    0x27f,      // 11
    0x27f,      // 12
    0x27f,      // 13
    0x27f,      // 14
    0x27f,      // 15
    0x1e71,     // 16
    0xdc0b,     // 17
    0xdc0b,     // 18
    0xdc0b,     // 19
    0xdc0b,     // 20
    0xc4fb,     // 21
    0xc4fb,     // 22
    0xc4fb,     // 23
    0x13aab,    // 24 
    0x11ca3,    // 25
    0x11ca3,    // 26
    0x11ca3,    // 27
    0x13aab,    // 28
    0x11ca3,    // 29
    0xc4fb,     // 30
    0xc4fb,     // 31



( run in 0.654 second using v1.01-cache-2.11-cpan-39bf76dae61 )