2022-11-29 16:25:24 +01:00
|
|
|
#include "test.h"
|
|
|
|
#include "trie.h"
|
|
|
|
#include "fuzzy.h"
|
|
|
|
|
|
|
|
void test_fuzzy() {
|
|
|
|
// Randomize seed
|
|
|
|
srand(time(NULL));
|
|
|
|
|
|
|
|
FuzzyConfig config;
|
|
|
|
int counter = 0;
|
|
|
|
int res;
|
|
|
|
|
2022-12-07 23:20:39 +01:00
|
|
|
for (int len = 2; len < 25; len += 5) {
|
2022-11-29 16:25:24 +01:00
|
|
|
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;
|
|
|
|
|
2022-12-07 12:56:31 +01:00
|
|
|
res = fuzzy_test_trie_seed(config);
|
2022-11-29 16:25:24 +01:00
|
|
|
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}
|
|
|
|
};
|