35 lines
791 B
C
35 lines
791 B
C
#include "test.h"
|
|
#include "trie.h"
|
|
#include "fuzzy.h"
|
|
|
|
void test_fuzzy() {
|
|
// Randomize seed
|
|
srand(time(NULL));
|
|
|
|
FuzzyConfig config;
|
|
int counter = 0;
|
|
int res;
|
|
|
|
for (int len = 1; len < 25; len += 5) {
|
|
for (int count = 10; count <= 500; count += 10) {
|
|
for (int i = 0; i < 50; i++) {
|
|
counter++;
|
|
|
|
config.seed = rand();
|
|
config.word_length = len;
|
|
config.word_count = count;
|
|
|
|
res = fuzzy_test_trie_seed(config);
|
|
TEST_CHECK_(res == 0,
|
|
"Failed config, seed = %i, len = %i, count = %i, code = %i", config.seed, config.word_length, config.word_count, res);
|
|
}
|
|
}
|
|
}
|
|
TEST_MSG("fuzzy tests done = %i", counter);
|
|
}
|
|
|
|
TEST_LIST = {
|
|
{ "customtrie fuzzy", test_fuzzy },
|
|
{ NULL, NULL}
|
|
};
|