Make Dictionary templatable so it can be used where we want a higher capacity.

This commit is contained in:
Adam Ierymenko 2016-06-21 07:32:58 -07:00
parent 3ee15e65aa
commit b2d048aa0e
12 changed files with 67 additions and 49 deletions

View file

@ -766,7 +766,7 @@ static int testOther()
std::cout << "[other] Testing/fuzzing Dictionary... "; std::cout.flush();
for(int k=0;k<1000;++k) {
Dictionary test;
Dictionary<8194> test;
char key[32][16];
char value[32][128];
for(unsigned int q=0;q<32;++q) {
@ -807,12 +807,12 @@ static int testOther()
int foo = 0;
volatile int *volatile bar = &foo; // force compiler not to optimize out test.get() below
for(int k=0;k<100;++k) {
int r = rand() % ZT_DICTIONARY_MAX_SIZE;
unsigned char tmp[ZT_DICTIONARY_MAX_SIZE];
int r = rand() % 8194;
unsigned char tmp[8194];
for(int q=0;q<r;++q)
tmp[q] = (unsigned char)((rand() % 254) + 1);
tmp[r] = 0;
Dictionary test((const char *)tmp);
Dictionary<8194> test((const char *)tmp);
for(unsigned int q=0;q<100;++q) {
char tmp[16];
Utils::snprintf(tmp,16,"%.8lx",(unsigned long)rand());