#include <maps/search/geocoder/basesearch/lib/response/address.h>
#include "mms_test_data.h"
#include <maps/libs/stringutils/include/join.h>
#include <maps/libs/stringutils/include/to_string.h>
#include <library/cpp/testing/gtest/gtest.h>
#include <fmt/format.h>
namespace maps::address {
std::string toString(const Component& c)
{
const auto result = stringutils::toString(c.kind) + ": " + c.name;
return c.excluded
? ("(" + result + ")")
: result;
}
std::string toString(const Components& cs)
{
using namespace stringutils;
return join(toStrings(cs), "; ");
}
} // namespace maps::address
namespace maps::search::geocoder {
std::string toString(const AddressComponents& a)
{
return
fmt::format("{}{}{} : {}",
toString(a.countryCode),
a.postalCode.empty() ? "" : "/",
a.postalCode,
toString(a.components));
}
using BuildAddressComponents = TestDataFixture;
TEST_F (BuildAddressComponents, givenDifferentTwins_buildsTheSameAddress)
{
EXPECT_EQ (toString(buildAddressComponents(ru_RU, object(RUSSIA_CRIMEA))),
"RU : country: Россия; (province: Крымский федеральный округ); province: Республика Крым"
);
EXPECT_EQ (toString(buildAddressComponents(ru_RU, object(UKRAINE_CRIMEA))),
"RU : country: Россия; (province: Крымский федеральный округ); province: Республика Крым"
);
}
TEST_F (BuildAddressComponents, givenAddressWithVirtualObject_skipsVirtualObjects)
{
EXPECT_EQ (toString(buildAddressComponents(ru_RU, object(RUSSIA_CRIMEA))),
"RU : country: Россия; (province: Крымский федеральный округ); province: Республика Крым"
);
EXPECT_EQ (toString(buildAddressComponents(uk_UA, object(RUSSIA_CRIMEA))),
"UA : country: Україна; province: Автономна республіка Крим"
);
}
TEST_F (BuildAddressComponents, givenExplicitPOVRegion_usesIt)
{
EXPECT_EQ (toString(buildAddressComponents(en_US, object(CRIMEA_ALUSHTA_NABEREZHNAYA))),
"UA : country: Ukraine; province: Crimea; locality: Alushta; street: Naberezhnaya"
);
EXPECT_EQ (toString(buildAddressComponents(locale::Region::Ru, en_US, object(CRIMEA_ALUSHTA_NABEREZHNAYA))),
"RU : country: Russia; (province: Крымский федеральный округ); province: Crimea; locality: Alushta; street: Naberezhnaya"
);
}
TEST_F (BuildAddressComponents, givenHouse_addsHouse)
{
EXPECT_EQ (toString(buildAddressComponents(ru_UA, object(CRIMEA_ALUSHTA_NABEREZHNAYA_1))),
"UA : country: Украина; province: Автономная Республика Крым; locality: Алушта; street: Набережная улица; house: 1"
);
}
TEST_F (BuildAddressComponents, givenAddressWithPostalCode_addsPostalCode)
{
EXPECT_EQ (toString(buildAddressComponents(ru_RU, object(MOSCOW_LEO_TOLSTOY_16))),
"RU/119021 : country: Россия; (province: Центральный федеральный округ); (province: Москва); locality: Москва; street: улица Льва Толстого; house: 16"
);
}
TEST_F (BuildAddressComponents, givenAddressWithEntrance_addsEntrance)
{
ASSERT_TRUE(object(MOSCOW_LEO_TOLSTOY_16).entrances().size() > 0);
EXPECT_EQ (toString(buildAddressComponents(ru_RU, object(MOSCOW_LEO_TOLSTOY_16), object(MOSCOW_LEO_TOLSTOY_16).entrances().at(0).get())),
"RU/119021 : country: Россия; (province: Центральный федеральный округ); (province: Москва); locality: Москва; street: улица Льва Толстого; house: 16; entrance: 1"
);
}
TEST_F (BuildAddressComponents, givenOtherAltNames_addAltNames)
{
const GeoDoc::AddressAltNames altNames = {
{ toponym(MOSCOW).id(), "МСК" },
{ toponym(MOSCOW_LEO_TOLSTOY).id(), "улица Яндекса" },
};
EXPECT_EQ (toString(buildAddressComponents(ru_RU, object(MOSCOW_LEO_TOLSTOY), nullptr, altNames)),
"RU : country: Россия; (province: Центральный федеральный округ); (province: Москва); locality: Москва (МСК); street: улица Льва Толстого (улица Яндекса)"
);
}
} // namespace maps::search::geocoder
Import status: Running file import (still 2 documents to extract)
Because of yet running and open tasks like text extraction and analysis maybe not all results were found yet, since at the moment of this search 2 file(s) could be only searched, overviewed and filtered by their file names only, not yet by their content and/or content based facets/filters!
You can prioritize the import(s) of (a) not yet processed file(s) by click on "Prioritize import" in the list view.
2022-02-24T04:00:00Z
test_address.cpp
Hashtags
- #include
- #include
- #include
- #include
- #include
- #include
Filename extension
cpp
etl_file_b:
1
1
etl_enhance_mapping_id_time_millis_i:
0
0
etl_enhance_mapping_id_b:
1
1
etl_filter_blacklist_time_millis_i:
0
0
etl_filter_blacklist_b:
1
1
etl_filter_file_not_modified_time_millis_i:
5
5
etl_filter_file_not_modified_b:
1
1
etl_enhance_extract_text_tika_server_ocr_enabled_b:
1
1
etl_count_images_yet_no_ocr_i:
0
0
etl_enhance_ocr_descew_b:
1
1
etl_enhance_pdf_ocr_b:
1
1
etl_enhance_extract_text_tika_server_time_millis_i:
98
98
etl_enhance_extract_text_tika_server_b:
1
1
etl_enhance_detect_language_tika_server_time_millis_i:
5
5
etl_enhance_detect_language_tika_server_b:
1
1
etl_enhance_contenttype_group_time_millis_i:
0
0
etl_enhance_contenttype_group_b:
1
1
etl_enhance_pst_time_millis_i:
0
0
etl_enhance_pst_b:
1
1
etl_enhance_csv_time_millis_i:
0
0
etl_enhance_csv_b:
1
1
etl_enhance_file_mtime_time_millis_i:
0
0
etl_enhance_file_mtime_b:
1
1
etl_enhance_path_time_millis_i:
0
0
etl_enhance_path_b:
1
1
etl_enhance_extract_hashtags_time_millis_i:
0
0
etl_enhance_extract_hashtags_b:
1
1
etl_enhance_warc_time_millis_i:
3
3
etl_enhance_warc_b:
1
1
etl_enhance_zip_time_millis_i:
0
0
etl_enhance_zip_b:
1
1
etl_clean_title_time_millis_i:
0
0
etl_clean_title_b:
1
1
etl_enhance_annotations_time_millis_i:
3
3
etl_enhance_annotations_b:
1
1
etl_enhance_multilingual_time_millis_i:
0
0
etl_enhance_multilingual_b:
1
1
etl_enhance_regex_time_millis_i:
1
1
etl_enhance_regex_b:
1
1
etl_time_millis_i:
122
122
X-TIKA_Parsed-By:
- org.apache.tika.parser.CompositeParser
- org.apache.tika.parser.DefaultParser
- org.apache.tika.parser.csv.TextAndCSVParser
X-TIKA_Parsed-By-Full-Set:
- org.apache.tika.parser.CompositeParser
- org.apache.tika.parser.DefaultParser
- org.apache.tika.parser.csv.TextAndCSVParser
X-TIKA_content_handler:
ToTextContentHandler
ToTextContentHandler
X-TIKA_parse_time_millis:
4
4
X-TIKA_embedded_depth:
0
0