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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
#include "testing/testing.hpp"
#include "indexer/editable_map_object.hpp"
namespace
{
using osm::EditableMapObject;
UNIT_TEST(EditableMapObject_SetWebsite)
{
EditableMapObject emo;
emo.SetWebsite("https://some.thing.org");
TEST_EQUAL(emo.GetWebsite(), "https://some.thing.org", ());
emo.SetWebsite("http://some.thing.org");
TEST_EQUAL(emo.GetWebsite(), "http://some.thing.org", ());
emo.SetWebsite("some.thing.org");
TEST_EQUAL(emo.GetWebsite(), "http://some.thing.org", ());
emo.SetWebsite("");
TEST_EQUAL(emo.GetWebsite(), "", ());
}
UNIT_TEST(EditableMapObject_ValidateBuildingLevels)
{
TEST(EditableMapObject::ValidateBuildingLevels(""), ());
TEST(EditableMapObject::ValidateBuildingLevels("7"), ());
TEST(EditableMapObject::ValidateBuildingLevels("17"), ());
TEST(EditableMapObject::ValidateBuildingLevels("25"), ());
TEST(!EditableMapObject::ValidateBuildingLevels("0"), ());
TEST(!EditableMapObject::ValidateBuildingLevels("005"), ());
TEST(!EditableMapObject::ValidateBuildingLevels("26"), ());
TEST(!EditableMapObject::ValidateBuildingLevels("22a"), ());
TEST(!EditableMapObject::ValidateBuildingLevels("a22"), ());
TEST(!EditableMapObject::ValidateBuildingLevels("2a22"), ());
TEST(!EditableMapObject::ValidateBuildingLevels("ab"), ());
TEST(!EditableMapObject::ValidateBuildingLevels(
"2345534564564453645534545345534564564453645"), ());
}
UNIT_TEST(EditableMapObject_ValidateHouseNumber)
{
TEST(EditableMapObject::ValidateHouseNumber(""), ());
TEST(EditableMapObject::ValidateHouseNumber("qwer7ty"), ());
TEST(EditableMapObject::ValidateHouseNumber("12345678"), ());
// House number must contain at least one number.
TEST(!EditableMapObject::ValidateHouseNumber("qwerty"), ());
// House number is too long.
TEST(!EditableMapObject::ValidateHouseNumber("1234567890123456"), ());
}
UNIT_TEST(EditableMapObject_ValidateFlats)
{
TEST(EditableMapObject::ValidateFlats(""), ());
TEST(EditableMapObject::ValidateFlats("123"), ());
TEST(EditableMapObject::ValidateFlats("123a"), ());
TEST(EditableMapObject::ValidateFlats("a"), ());
TEST(EditableMapObject::ValidateFlats("123-456;a-e"), ());
TEST(EditableMapObject::ValidateFlats("123-456"), ());
TEST(EditableMapObject::ValidateFlats("123-456; 43-45"), ());
TEST(!EditableMapObject::ValidateFlats("123-456, 43-45"), ());
TEST(!EditableMapObject::ValidateFlats("234-234 124"), ());
TEST(!EditableMapObject::ValidateFlats("123-345-567"), ());
TEST(!EditableMapObject::ValidateFlats("234-234;234("), ());
TEST(!EditableMapObject::ValidateFlats("-;"), ());
}
// See search_tests/postcodes_matcher_test.cpp
// UNIT_TEST(EditableMapObject_ValidatePostCode)
// {
// }
UNIT_TEST(EditableMapObject_ValidatePhone)
{
TEST(EditableMapObject::ValidatePhone(""), ());
TEST(EditableMapObject::ValidatePhone("+7 000 000 00 00"), ());
TEST(EditableMapObject::ValidatePhone("+7 (000) 000 00 00"), ());
TEST(EditableMapObject::ValidatePhone("+7 0000000000"), ());
TEST(EditableMapObject::ValidatePhone("+7 0000 000 000"), ());
TEST(EditableMapObject::ValidatePhone("8 0000-000-000"), ());
TEST(EditableMapObject::ValidatePhone("000 00 00"), ());
TEST(EditableMapObject::ValidatePhone("000 000 00"), ());
TEST(EditableMapObject::ValidatePhone("+00 0000 000 000"), ());
TEST(!EditableMapObject::ValidatePhone("+00 0000 000 0000 000"), ());
TEST(!EditableMapObject::ValidatePhone("00 00"), ());
TEST(!EditableMapObject::ValidatePhone("acb"), ());
TEST(!EditableMapObject::ValidatePhone("000 000 00b"), ());
}
UNIT_TEST(EditableMapObject_ValidateWebsite)
{
TEST(EditableMapObject::ValidateWebsite(""), ());
TEST(EditableMapObject::ValidateWebsite("qwe.rty"), ());
TEST(!EditableMapObject::ValidateWebsite("qwerty"), ());
TEST(!EditableMapObject::ValidateWebsite(".qwerty"), ());
TEST(!EditableMapObject::ValidateWebsite("qwerty."), ());
TEST(!EditableMapObject::ValidateWebsite(".qwerty."), ());
TEST(!EditableMapObject::ValidateWebsite(".qwerty."), ());
TEST(!EditableMapObject::ValidateWebsite("w..com"), ());
}
UNIT_TEST(EditableMapObject_ValidateEmail)
{
TEST(EditableMapObject::ValidateEmail(""), ());
TEST(EditableMapObject::ValidateEmail("e@ma.il"), ());
TEST(EditableMapObject::ValidateEmail("e@ma.i.l"), ());
TEST(EditableMapObject::ValidateEmail("e-m.ail@dot.com.gov"), ());
TEST(EditableMapObject::ValidateEmail("#$%&'*+-/=?^`_{}|~.@dot.qw.com.gov"), ());
TEST(!EditableMapObject::ValidateEmail("e.ma.il"), ());
TEST(!EditableMapObject::ValidateEmail("e@ma@il"), ());
TEST(!EditableMapObject::ValidateEmail("e@ma@i.l"), ());
TEST(!EditableMapObject::ValidateEmail("e@mail"), ());
TEST(!EditableMapObject::ValidateEmail("@email.a"), ());
TEST(!EditableMapObject::ValidateEmail("emai.l@"), ());
TEST(!EditableMapObject::ValidateEmail("emai@l."), ());
TEST(!EditableMapObject::ValidateEmail("e mai@l.com"), ());
TEST(!EditableMapObject::ValidateEmail("emai@.l"), ());
TEST(!EditableMapObject::ValidateEmail("emai@_l.ab"), ());
TEST(!EditableMapObject::ValidateEmail("emai@l_.ab"), ());
TEST(!EditableMapObject::ValidateEmail("email@e#$%&'*+-/=?^`_{}|~.com"), ());
}
} // namespace
|