[fix/expand] adding test case for new per-language expansions. Also fixes #354

This commit is contained in:
Al
2019-02-16 22:31:59 -05:00
parent 42207769ef
commit 21601eb4b8

View File

@@ -96,13 +96,13 @@ static greatest_test_res test_expansion_contains_phrase_option_with_languages(ch
static greatest_test_res test_expansion_contains_with_languages(char *input, char *output, libpostal_normalize_options_t options, size_t num_languages, ...) {
bool root = false;
va_list args;
if (num_languages > 0) {
va_list args;
va_start(args, num_languages);
CHECK_CALL(test_expansion_contains_phrase_option_with_languages(input, output, options, root, num_languages, args));
va_end(args);
} else {
CHECK_CALL(test_expansion_contains_phrase_option_with_languages(input, output, options, root, num_languages, NULL));
CHECK_CALL(test_expansion_contains_phrase_option_with_languages(input, output, options, root, num_languages, args));
}
PASS();
}
@@ -110,13 +110,13 @@ static greatest_test_res test_expansion_contains_with_languages(char *input, cha
static greatest_test_res test_root_expansion_contains_with_languages(char *input, char *output, libpostal_normalize_options_t options, size_t num_languages, ...) {
bool root = true;
va_list args;
if (num_languages > 0) {
va_list args;
va_start(args, num_languages);
CHECK_CALL(test_expansion_contains_phrase_option_with_languages(input, output, options, root, num_languages, args));
va_end(args);
} else {
CHECK_CALL(test_expansion_contains_phrase_option_with_languages(input, output, options, root, num_languages, NULL));
CHECK_CALL(test_expansion_contains_phrase_option_with_languages(input, output, options, root, num_languages, args));
}
PASS();
}
@@ -182,6 +182,9 @@ TEST test_street_root_expansions(void) {
CHECK_CALL(test_root_expansion_contains("Center Street E", "center", options));
CHECK_CALL(test_root_expansion_contains("Ctr Street E", "center", options));
CHECK_CALL(test_root_expansion_contains_with_languages("W. UNION STREET", "union", options, 2, "en", "es"));
// Spanish
CHECK_CALL(test_root_expansion_contains("C/ Ocho", "8", options));
PASS();