From 1d22da603f5970ba796b041f4f76dcfd5e98f31c Mon Sep 17 00:00:00 2001 From: Al Date: Sun, 17 Dec 2017 20:17:28 -0500 Subject: [PATCH] [test] house number expansion tests --- test/test_expand.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/test_expand.c b/test/test_expand.c index 2b211728..dffd6785 100644 --- a/test/test_expand.c +++ b/test/test_expand.c @@ -169,6 +169,23 @@ TEST test_street_root_expansions(void) { PASS(); } + +TEST test_house_number_root_expansions(void) { + libpostal_normalize_options_t options = libpostal_get_default_options(); + options.address_components = LIBPOSTAL_ADDRESS_HOUSE_NUMBER | LIBPOSTAL_ADDRESS_ANY; + + // English - normal cases + CHECK_CALL(test_root_expansion_contains("1A", "1 a", options)); + CHECK_CALL(test_root_expansion_contains("A1", "a 1", options)); + CHECK_CALL(test_root_expansion_contains("1", "1", options)); + CHECK_CALL(test_root_expansion_contains_with_languages("# 1", "1", options, 1, "en")); + CHECK_CALL(test_root_expansion_contains_with_languages("No. 1", "1", options, 1, "en")); + CHECK_CALL(test_root_expansion_contains_with_languages("House No. 1", "1", options, 1, "en")); + CHECK_CALL(test_root_expansion_contains_with_languages("House #1", "1", options, 1, "en")); + + PASS(); +} + TEST test_expansions_language_classifier(void) { libpostal_normalize_options_t options = libpostal_get_default_options(); @@ -211,6 +228,7 @@ SUITE(libpostal_expansion_tests) { RUN_TEST(test_expansions); RUN_TEST(test_street_root_expansions); + RUN_TEST(test_house_number_root_expansions); RUN_TEST(test_expansions_language_classifier); RUN_TEST(test_expansions_no_options);