2023-10-14 14:33:22 +02:00
|
|
|
#include "test.h"
|
|
|
|
#include "lsm.h"
|
|
|
|
#include "lsm/trie_internal.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) {
|
2023-10-14 14:53:42 +02:00
|
|
|
for (int i = 0; i < 10; i++) {
|
2023-10-14 14:33:22 +02:00
|
|
|
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 = {
|
2023-10-14 14:53:42 +02:00
|
|
|
{ "trie fuzzy", test_fuzzy },
|
2023-10-14 14:33:22 +02:00
|
|
|
{ NULL, NULL}
|
|
|
|
};
|