summaryrefslogtreecommitdiff
path: root/test/utf8.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/utf8.c')
-rw-r--r--test/utf8.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/test/utf8.c b/test/utf8.c
index f18eca0..5d75cb6 100644
--- a/test/utf8.c
+++ b/test/utf8.c
@@ -3,43 +3,33 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "fuzzy_match.h"
+#include "matching.h"
#include "tap.h"
-void is_simple_match(const char *pattern, const char *str, const char *message)
+void is_single_match(enum matching_algorithm algorithm, const char *pattern, const char *str, const char *message)
{
- int32_t res = fuzzy_match_simple_words(pattern, str);
+ int32_t res = match_words(algorithm, pattern, str);
tap_isnt(res, INT32_MIN, message);
}
-void isnt_simple_match(const char *pattern, const char *str, const char *message)
+void isnt_single_match(enum matching_algorithm algorithm, const char *pattern, const char *str, const char *message)
{
- int32_t res = fuzzy_match_simple_words(pattern, str);
- tap_is(res, INT32_MIN, message);
-}
-
-void is_fuzzy_match(const char *pattern, const char *str, const char *message)
-{
- int32_t res = fuzzy_match_words(pattern, str);
- tap_isnt(res, INT32_MIN, message);
-}
-
-void isnt_fuzzy_match(const char *pattern, const char *str, const char *message)
-{
- int32_t res = fuzzy_match_words(pattern, str);
+ int32_t res = match_words(algorithm, pattern, str);
tap_is(res, INT32_MIN, message);
}
void is_match(const char *pattern, const char *str, const char *message)
{
- is_simple_match(pattern, str, message);
- is_fuzzy_match(pattern, str, message);
+ is_single_match(MATCHING_ALGORITHM_NORMAL, pattern, str, message);
+ is_single_match(MATCHING_ALGORITHM_PREFIX, pattern, str, message);
+ is_single_match(MATCHING_ALGORITHM_FUZZY, pattern, str, message);
}
void isnt_match(const char *pattern, const char *str, const char *message)
{
- isnt_simple_match(pattern, str, message);
- isnt_fuzzy_match(pattern, str, message);
+ isnt_single_match(MATCHING_ALGORITHM_NORMAL, pattern, str, message);
+ isnt_single_match(MATCHING_ALGORITHM_PREFIX, pattern, str, message);
+ isnt_single_match(MATCHING_ALGORITHM_FUZZY, pattern, str, message);
}
int main(int argc, char *argv[])
@@ -56,9 +46,9 @@ int main(int argc, char *argv[])
/* Combining diacritics. */
isnt_match("o", "ọ", "Single character with composed diacritic");
- isnt_simple_match("ạ", "aọ", "Decomposed diacritics, character mismatch");
+ isnt_single_match(MATCHING_ALGORITHM_NORMAL, "ạ", "aọ", "Decomposed diacritics, character mismatch");
tap_todo("Needs composed character comparison");
- isnt_fuzzy_match("ạ", "aọ", "Decomposed diacritics, character mismatch");
+ isnt_single_match(MATCHING_ALGORITHM_FUZZY, "ạ", "aọ", "Decomposed diacritics, character mismatch");
tap_plan();