Files
comaps/indexer/indexer_tests/postcodes_matcher_tests.cpp
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

43 lines
1.9 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "testing/testing.hpp"
#include "indexer/postcodes_matcher.hpp"
namespace postcodes_matcher_test
{
using namespace search;
UNIT_TEST(PostcodesMatcher_Smoke)
{
/// @todo We are not _complete_ here, because G4 is also a postcode prefix (Glasgow, Scotland)
/// like BN1 or BN3 (Brighton).
TEST(!LooksLikePostcode("G4", false /* handleAsPrefix */), ());
TEST(LooksLikePostcode("G4", true /* handleAsPrefix */), ());
TEST(LooksLikePostcode("BN1", false /* handleAsPrefix */), ());
TEST(LooksLikePostcode("BN3 ", false /* handleAsPrefix */), ());
TEST(LooksLikePostcode("BN1", true /* handleAsPrefix */), ());
TEST(LooksLikePostcode("BN3 ", true /* handleAsPrefix */), ());
TEST(LooksLikePostcode("141701", false /* handleAsPrefix */), ());
TEST(LooksLikePostcode("141", true /* handleAsPrefix */), ());
TEST(LooksLikePostcode("BA6 8JP", true /* handleAsPrefix */), ());
TEST(LooksLikePostcode("BA6-8JP", true /* handleAsPrefix */), ());
TEST(LooksLikePostcode("BA22 9HR", true /* handleAsPrefix */), ());
TEST(LooksLikePostcode("BA22", true /* handleAsPrefix */), ());
TEST(LooksLikePostcode("DE56 4FW", true /* handleAsPrefix */), ());
TEST(LooksLikePostcode("NY 1000", true /* handleAsPrefix */), ());
TEST(LooksLikePostcode("AZ 85203", true /* handleAsPrefix */), ());
TEST(LooksLikePostcode("AZ", true /* handleAsPrefix */), ());
TEST(LooksLikePostcode("803 0271", true /* handleAsPrefix */), ());
TEST(LooksLikePostcode("803-0271", true /* handleAsPrefix */), ());
TEST(LooksLikePostcode("〒803-0271", true /* handleAsPrefix */), ());
TEST(!LooksLikePostcode("1 мая", true /* handleAsPrefix */), ());
TEST(!LooksLikePostcode("1 мая улица", true /* handleAsPrefix */), ());
TEST(!LooksLikePostcode("москва", true /* handleAsPrefix */), ());
TEST(!LooksLikePostcode("39 с 79", true /* handleAsPrefix */), ());
}
} // namespace postcodes_matcher_test