forked from organicmaps/organicmaps
[editor] review fixes
This commit is contained in:
parent
0e3a046555
commit
9d8432c63d
2 changed files with 10 additions and 3 deletions
|
@ -635,9 +635,9 @@ bool EditableMapObject::ValidatePhoneList(string const & phone)
|
|||
{
|
||||
// BNF:
|
||||
// <digit> ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
|
||||
// <available_chars> ::= ' ' | '+' | '-' | '(' | ')' | '' <available_chars>
|
||||
// <available_char> ::= ' ' | '+' | '-' | '(' | ')'
|
||||
// <delimeter> ::= ',' | ';'
|
||||
// <phone> ::= <digit> | <available_chars> <phone>
|
||||
// <phone> ::= (<digit> | <available_chars>)+
|
||||
// <phone_list> ::= '' | <phone> | <phone> <delimeter> <phone_list>
|
||||
|
||||
if (phone.empty())
|
||||
|
@ -667,7 +667,7 @@ bool EditableMapObject::ValidatePhoneList(string const & phone)
|
|||
return false;
|
||||
|
||||
if (isdigit(*curr))
|
||||
++digitsCount;
|
||||
++digitsCount;
|
||||
}
|
||||
|
||||
if (digitsCount < kMinNumberLen || digitsCount > kMaxNumberLen)
|
||||
|
|
|
@ -139,6 +139,13 @@ UNIT_TEST(EditableMapObject_ValidatePhoneList)
|
|||
TEST(!EditableMapObject::ValidatePhoneList(";"), ());
|
||||
TEST(!EditableMapObject::ValidatePhoneList(","), ());
|
||||
TEST(!EditableMapObject::ValidatePhoneList(";;;;;;"), ());
|
||||
|
||||
// Now it is possible to specify the following incorrect phone numbers.
|
||||
// TODO: replace current implementation of ValidatePhoneList by a correct one.
|
||||
TEST(EditableMapObject::ValidatePhoneList("7+ 10 10"), ());
|
||||
TEST(EditableMapObject::ValidatePhoneList("+7 )10( 10"), ());
|
||||
TEST(EditableMapObject::ValidatePhoneList("+7 )10 10"), ());
|
||||
TEST(EditableMapObject::ValidatePhoneList("+7 10 (---) 10"), ());
|
||||
}
|
||||
|
||||
UNIT_TEST(EditableMapObject_ValidateWebsite)
|
||||
|
|
Loading…
Add table
Reference in a new issue