Welcome to mirror list, hosted at ThFree Co, Russian Federation.

postcodes_matcher_tests.cpp « indexer_tests « indexer - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b804785572b02babeeb31e39d595f855dcf4b475 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "../../testing/testing.hpp"

#include "indexer/postcodes_matcher.hpp"
#include "indexer/search_delimiters.hpp"
#include "indexer/search_string_utils.hpp"

#include "base/stl_add.hpp"
#include "base/string_utils.hpp"

#include "std/string.hpp"
#include "std/vector.hpp"

using namespace strings;

namespace search
{
namespace v2
{
namespace
{
UNIT_TEST(PostcodesMatcher_Smoke)
{
  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
}  // namespace v2
}  // namespace search