[api] doing this now since we're bumping a major version. Using a libpostal prefixes for all public header functions and definitions
This commit is contained in:
@@ -8,9 +8,9 @@
|
||||
|
||||
SUITE(libpostal_expansion_tests);
|
||||
|
||||
static greatest_test_res test_expansion_contains(char *input, char *output, normalize_options_t options) {
|
||||
static greatest_test_res test_expansion_contains(char *input, char *output, libpostal_normalize_options_t options) {
|
||||
size_t num_expansions;
|
||||
char **expansions = expand_address(input, options, &num_expansions);
|
||||
char **expansions = libpostal_expand_address(input, options, &num_expansions);
|
||||
|
||||
bool contains_expansion = false;
|
||||
char *expansion;
|
||||
@@ -23,6 +23,8 @@ static greatest_test_res test_expansion_contains(char *input, char *output, norm
|
||||
|
||||
}
|
||||
|
||||
libpostal_expansion_array_destroy(expansions, num_expansions);
|
||||
|
||||
if (!contains_expansion) {
|
||||
printf("Expansions should contain %s, got {", output);
|
||||
for (size_t i = 0; i < num_expansions; i++) {
|
||||
@@ -36,7 +38,7 @@ static greatest_test_res test_expansion_contains(char *input, char *output, norm
|
||||
PASS();
|
||||
}
|
||||
|
||||
static greatest_test_res test_expansion_contains_with_languages(char *input, char *output, normalize_options_t options, size_t num_languages, ...) {
|
||||
static greatest_test_res test_expansion_contains_with_languages(char *input, char *output, libpostal_normalize_options_t options, size_t num_languages, ...) {
|
||||
char **languages = NULL;
|
||||
|
||||
size_t i;
|
||||
@@ -50,7 +52,7 @@ static greatest_test_res test_expansion_contains_with_languages(char *input, cha
|
||||
|
||||
for (i = 0; i < num_languages; i++) {
|
||||
lang = va_arg(args, char *);
|
||||
ASSERT(strlen(lang) < MAX_LANGUAGE_LEN);
|
||||
ASSERT(strlen(lang) < LIBPOSTAL_MAX_LANGUAGE_LEN);
|
||||
languages[i] = strdup(lang);
|
||||
}
|
||||
|
||||
@@ -75,7 +77,7 @@ static greatest_test_res test_expansion_contains_with_languages(char *input, cha
|
||||
|
||||
|
||||
TEST test_expansions(void) {
|
||||
normalize_options_t options = get_libpostal_default_options();
|
||||
libpostal_normalize_options_t options = libpostal_get_default_options();
|
||||
|
||||
CHECK_CALL(test_expansion_contains_with_languages("123 Main St. #2f", "123 main street number 2f", options, 1, "en"));
|
||||
CHECK_CALL(test_expansion_contains_with_languages("S St. NW", "s street northwest", options, 1, "en"));
|
||||
@@ -86,7 +88,7 @@ TEST test_expansions(void) {
|
||||
}
|
||||
|
||||
TEST test_expansions_language_classifier(void) {
|
||||
normalize_options_t options = get_libpostal_default_options();
|
||||
libpostal_normalize_options_t options = libpostal_get_default_options();
|
||||
|
||||
CHECK_CALL(test_expansion_contains_with_languages("V XX Sett", "via 20 settembre", options, 0, NULL));
|
||||
CHECK_CALL(test_expansion_contains_with_languages("C/ Ocho", "calle 8", options, 0, NULL));
|
||||
@@ -94,7 +96,7 @@ TEST test_expansions_language_classifier(void) {
|
||||
}
|
||||
|
||||
TEST test_expansions_no_options(void) {
|
||||
normalize_options_t options = get_libpostal_default_options();
|
||||
libpostal_normalize_options_t options = libpostal_get_default_options();
|
||||
options.lowercase = false;
|
||||
options.latin_ascii = false;
|
||||
options.transliterate = false;
|
||||
|
||||
Reference in New Issue
Block a user