phony 1.9.0 → 2.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +1 -1
- data/lib/phony.rb +28 -15
- data/lib/phony/countries.rb +609 -210
- data/lib/phony/countries/austria.rb +6 -1
- data/lib/phony/countries/bangladesh.rb +55 -0
- data/lib/phony/countries/belarus.rb +130 -0
- data/lib/phony/countries/georgia.rb +91 -0
- data/lib/phony/countries/germany.rb +20 -6
- data/lib/phony/countries/india.rb +50 -0
- data/lib/phony/countries/indonesia.rb +50 -0
- data/lib/phony/countries/italy.rb +38 -67
- data/lib/phony/countries/japan.rb +412 -0
- data/lib/phony/countries/kyrgyzstan.rb +118 -0
- data/lib/phony/countries/latvia.rb +40 -0
- data/lib/phony/countries/libya.rb +114 -0
- data/lib/phony/countries/malaysia.rb +7 -5
- data/lib/phony/countries/moldova.rb +50 -0
- data/lib/phony/countries/montenegro.rb +27 -0
- data/lib/phony/countries/namibia.rb +35 -0
- data/lib/phony/countries/nepal.rb +71 -0
- data/lib/phony/countries/netherlands.rb +3 -2
- data/lib/phony/countries/pakistan.rb +119 -0
- data/lib/phony/countries/paraguay.rb +145 -0
- data/lib/phony/countries/russia_kazakhstan_abhasia_south_osetia.rb +6 -6
- data/lib/phony/countries/serbia.rb +34 -0
- data/lib/phony/countries/somali.rb +22 -0
- data/lib/phony/countries/south_korea.rb +1 -1
- data/lib/phony/countries/sweden.rb +1 -1
- data/lib/phony/countries/taiwan.rb +51 -0
- data/lib/phony/countries/tajikistan.rb +76 -0
- data/lib/phony/countries/turkmenistan.rb +73 -0
- data/lib/phony/countries/ukraine.rb +614 -0
- data/lib/phony/countries/uruguay.rb +51 -0
- data/lib/phony/countries/zimbabwe.rb +37 -0
- data/lib/phony/country.rb +41 -0
- data/lib/phony/country_codes.rb +45 -18
- data/lib/phony/dsl.rb +33 -7
- data/lib/phony/local_splitters/fixed.rb +14 -1
- data/lib/phony/local_splitters/regex.rb +12 -1
- data/lib/phony/national_code.rb +7 -3
- data/lib/phony/national_splitters/default.rb +13 -1
- data/lib/phony/national_splitters/dsl.rb +9 -7
- data/lib/phony/national_splitters/fixed.rb +6 -0
- data/lib/phony/national_splitters/none.rb +6 -0
- data/lib/phony/national_splitters/regex.rb +6 -0
- data/lib/phony/national_splitters/variable.rb +7 -1
- data/spec/lib/phony/countries_spec.rb +684 -16
- data/spec/lib/phony/local_splitters/regex_spec.rb +41 -0
- data/spec/lib/phony/validations_spec.rb +542 -10
- data/spec/lib/phony_spec.rb +20 -6
- metadata +29 -9
- data/lib/phony/validator.rb +0 -26
- data/lib/phony/validators.rb +0 -88
@@ -9,15 +9,17 @@ module Phony
|
|
9
9
|
#
|
10
10
|
#
|
11
11
|
def >> local_splitter
|
12
|
-
|
12
|
+
if local_splitter.respond_to? :split
|
13
|
+
country_for local_splitter, true
|
14
|
+
else
|
15
|
+
local_splitter.national_splitter = self
|
16
|
+
local_splitter
|
17
|
+
end
|
13
18
|
end
|
14
19
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
national_code = Phony::NationalCode.new self, local_splitter, with_zero
|
19
|
-
Phony::Country.new national_code
|
20
|
-
end
|
20
|
+
def country_for local_splitter, with_zero, trunk = '0'
|
21
|
+
Phony::Country.new Phony::NationalCode.new(self, local_splitter, with_zero, trunk)
|
22
|
+
end
|
21
23
|
|
22
24
|
end
|
23
25
|
|
@@ -37,6 +37,12 @@ module Phony
|
|
37
37
|
super fallback_number
|
38
38
|
end
|
39
39
|
|
40
|
+
# A valid length.
|
41
|
+
#
|
42
|
+
def length
|
43
|
+
(@mapped_ndc_min_length..@mapped_ndc_max_length)
|
44
|
+
end
|
45
|
+
|
40
46
|
private
|
41
47
|
|
42
48
|
# def restructure ndc_map
|
@@ -45,7 +51,7 @@ module Phony
|
|
45
51
|
|
46
52
|
# Optimizes and restructures the given ndcs array.
|
47
53
|
#
|
48
|
-
def optimize
|
54
|
+
def optimize ndc_ary
|
49
55
|
ndcs = {}
|
50
56
|
ndc_ary.each do |ndc|
|
51
57
|
ndcs[ndc.length] ||= []
|
@@ -26,6 +26,7 @@ describe 'country descriptions' do
|
|
26
26
|
it_splits '5491112345678', ['54', '911', '1234', '5678']
|
27
27
|
it_splits '5492201234567', ['54', '9220', '123', '4567']
|
28
28
|
it_splits '5492221123456', ['54', '92221', '12', '3456']
|
29
|
+
it_splits '548001234567', ['54', '800', '123', '4567']
|
29
30
|
end
|
30
31
|
describe 'Austria' do
|
31
32
|
it_splits '43198110', ['43', '1', '98110'] # Vienna
|
@@ -37,6 +38,32 @@ describe 'country descriptions' do
|
|
37
38
|
it_splits '61512341234', ['61', '5', '1234', '1234'] # Landline
|
38
39
|
it_splits '61423123123', ['61', '423', '123', '123'] # Mobile
|
39
40
|
end
|
41
|
+
|
42
|
+
describe 'Bahrain' do
|
43
|
+
it_splits '97312345678', ['973', false, '1234', '5678']
|
44
|
+
end
|
45
|
+
|
46
|
+
describe 'Bangladesh' do
|
47
|
+
it_splits '88021234567', %w(880 2 1234567)
|
48
|
+
it_splits '8805112345', %w(880 51 12345)
|
49
|
+
it_splits '88031123456', %w(880 31 123456)
|
50
|
+
it_splits '88032112345', %w(880 321 12345)
|
51
|
+
it_splits '8804311234567', %w(880 431 1234567)
|
52
|
+
it_splits '880902012345', %w(880 9020 12345)
|
53
|
+
end
|
54
|
+
|
55
|
+
describe 'Belarus' do
|
56
|
+
it_splits '375152123456', %w(375 152 123456)
|
57
|
+
it_splits '375151512345', %w(375 1515 12345)
|
58
|
+
it_splits '375163423456', %w(375 163 423456)
|
59
|
+
it_splits '375163112345', %w(375 1631 12345)
|
60
|
+
it_splits '375291234567', %w(375 29 1234567)
|
61
|
+
it_splits '375800123', %w(375 800 123)
|
62
|
+
it_splits '3758001234', %w(375 800 1234)
|
63
|
+
it_splits '3758001234567', %w(375 800 1234567)
|
64
|
+
it_splits '37582012345678', %w(375 820 12345678)
|
65
|
+
end
|
66
|
+
|
40
67
|
describe 'Belgium' do
|
41
68
|
it_splits '3235551212', ['32', '3', '555', '1212'] # Antwerpen
|
42
69
|
it_splits '32505551212', ['32', '50', '555', '1212'] # Brugge
|
@@ -47,6 +74,27 @@ describe 'country descriptions' do
|
|
47
74
|
it_splits '32475279584', ['32', '475', '279584'] # mobile
|
48
75
|
it_splits '3270123123', ['32', '70', '123', '123'] # Bus Service?
|
49
76
|
end
|
77
|
+
|
78
|
+
describe 'Belize' do
|
79
|
+
it_splits '5012051234', %w(501 205 1234)
|
80
|
+
end
|
81
|
+
|
82
|
+
describe 'Benin' do
|
83
|
+
it_splits '22912345678', ['229', false, '1234', '5678']
|
84
|
+
end
|
85
|
+
|
86
|
+
describe 'Bolivia' do
|
87
|
+
it_splits '59122772266', %w(591 2 277 2266)
|
88
|
+
end
|
89
|
+
|
90
|
+
describe 'Botswana' do
|
91
|
+
it_splits '26780123456', %w(267 80 123 456)
|
92
|
+
it_splits '2672956789', %w(267 29 567 89)
|
93
|
+
it_splits '2674634567', %w(267 463 4567)
|
94
|
+
it_splits '2675812345', %w(267 58 123 45)
|
95
|
+
it_splits '26776712345', %w(267 7 6712 345)
|
96
|
+
it_splits '26781234567', %w(267 8 1234 567)
|
97
|
+
end
|
50
98
|
describe 'Brazil' do
|
51
99
|
it_splits '551112341234', ['55', '11', '1234', '1234']
|
52
100
|
it_splits '5511981231234', ['55', '11', '9812', '31234'] # São Paulo's 9 digits mobile
|
@@ -67,6 +115,10 @@ describe 'country descriptions' do
|
|
67
115
|
it_splits '862112345678', ['86', '21', '1234', '5678'] # Shanghai
|
68
116
|
it_splits '8675582193447', ['86', '755', '8219', '3447'] # Shenzhen
|
69
117
|
end
|
118
|
+
describe 'Colombia' do
|
119
|
+
it_splits '5711234567', ['57', '1', '123', '4567']
|
120
|
+
it_splits '573101234567', ['57', '310', '123', '4567'] # mobile
|
121
|
+
end
|
70
122
|
describe 'Croatia' do
|
71
123
|
it_splits '385112312345', ['385', '1', '123', '12345'] # Zagreb
|
72
124
|
it_splits '385491231234', ['385', '49', '123', '1234'] # Krapina
|
@@ -89,6 +141,10 @@ describe 'country descriptions' do
|
|
89
141
|
it_splits '20921234567', ['20', '92', '1234567']
|
90
142
|
it_splits '20951234567', ['20', '95', '1234567']
|
91
143
|
end
|
144
|
+
describe 'Equatorial Guinea' do
|
145
|
+
it_splits '240222201123', ['240', false, '222', '201', '123']
|
146
|
+
it_splits '240335201123', ['240', false, '335', '201', '123']
|
147
|
+
end
|
92
148
|
describe 'Estonia' do
|
93
149
|
it_splits '3723212345', ['372', '321', '2345'] # Landline
|
94
150
|
it_splits '37251231234', ['372', '5123', '1234'] # Mobile
|
@@ -96,6 +152,7 @@ describe 'country descriptions' do
|
|
96
152
|
it_splits '37281231234', ['372', '8123', '1234'] # Mobile
|
97
153
|
it_splits '37282231234', ['372', '8223', '1234'] # Mobile
|
98
154
|
it_splits '37283212345', ['372', '832', '12345'] # Mobile
|
155
|
+
it_splits '37270121234', ['372', '7012', '1234'] # Premium
|
99
156
|
end
|
100
157
|
describe 'Finland' do
|
101
158
|
it_splits '3589123123', ['358', '9', '123', '123'] # Helsinki
|
@@ -107,6 +164,12 @@ describe 'country descriptions' do
|
|
107
164
|
it_splits '33112345678', ['33', '1', '12','34','56','78'] # Paris
|
108
165
|
it_splits '33812345678', ['33', '8', '12','34','56','78'] # Service number
|
109
166
|
end
|
167
|
+
describe 'Georgia' do
|
168
|
+
it_splits '99522012345', %w(995 220 123 45)
|
169
|
+
it_splits '995321234567', %w(995 32 123 4567)
|
170
|
+
it_splits '995342123456', %w(995 342 123 456)
|
171
|
+
it_splits '995596123456', %w(995 596 123 456)
|
172
|
+
end
|
110
173
|
describe 'Germany' do
|
111
174
|
it_splits '493038625454', ['49', '30', '386', '25454'] # Berlin
|
112
175
|
it_splits '4932221764542', ['49', '32', '221', '764542'] # Non-Geographical
|
@@ -116,6 +179,9 @@ describe 'country descriptions' do
|
|
116
179
|
it_splits '493434144602', ['49', '34341', '446', '02'] # Geithain
|
117
180
|
it_splits '491805878323', ['49', '180', '587', '8323'] # Service number
|
118
181
|
it_splits '491815878323', ['49', '181', '587', '8323'] # Service number
|
182
|
+
it_splits '4915112312345', ['49', '151', '123', '12345'] # Mobile number
|
183
|
+
it_splits '49152112312345',['49', '1521', '123', '12345'] # Mobile number
|
184
|
+
it_splits '4916312312345', ['49', '163', '123', '12345'] # Mobile number
|
119
185
|
end
|
120
186
|
describe 'Ghana' do
|
121
187
|
it_splits '233302123456', ['233', '30', '212', '3456'] # Mobile Vodafone, Accra
|
@@ -132,12 +198,27 @@ describe 'country descriptions' do
|
|
132
198
|
it_splits '3508012', ['350', '8012', '' ] # Freephone
|
133
199
|
end
|
134
200
|
describe 'Greece' do
|
135
|
-
it_splits '
|
136
|
-
it_splits '
|
137
|
-
it_splits '
|
138
|
-
it_splits '
|
139
|
-
it_splits '
|
201
|
+
it_splits '302142345678', %w(30 21 4234 5678)
|
202
|
+
it_splits '302442345678', %w(30 24 4234 5678)
|
203
|
+
it_splits '305034571234', %w(30 50 3457 1234)
|
204
|
+
it_splits '306901234567', %w(30 69 0123 4567)
|
205
|
+
it_splits '307001234567', %w(30 70 0123 4567)
|
206
|
+
it_splits '308001001234', %w(30 800 100 1234)
|
207
|
+
it_splits '308011001234', %w(30 801 100 1234)
|
208
|
+
it_splits '308071001234', %w(30 807 100 1234)
|
209
|
+
it_splits '308961001234', %w(30 896 100 1234)
|
210
|
+
it_splits '309011234565', %w(30 901 123 4565)
|
211
|
+
it_splits '309091234565', %w(30 909 123 4565)
|
140
212
|
end
|
213
|
+
|
214
|
+
describe 'Haiti' do
|
215
|
+
it_splits '50922121234', ['509', '22', '12', '1234']
|
216
|
+
end
|
217
|
+
|
218
|
+
describe 'Hong Kong' do
|
219
|
+
it_splits '85212341234', ['852', false, '1234', '1234'] #
|
220
|
+
end
|
221
|
+
|
141
222
|
describe 'Hungary' do
|
142
223
|
it_splits'3612345678', ['36', '1', '234', '5678']
|
143
224
|
it_splits'3622123456', ['36', '22', '123', '456']
|
@@ -149,10 +230,51 @@ describe 'country descriptions' do
|
|
149
230
|
it_splits '3545511234', ['354', false, '551', '1234'] # Reykjavík
|
150
231
|
end
|
151
232
|
describe 'Indonesia' do
|
152
|
-
it_splits '6242323032', [
|
153
|
-
it_splits '6285220119289', ['62', '852', '
|
154
|
-
it_splits '62217815263', ['62', '21', '
|
233
|
+
it_splits '6242323032', ["62", "4", "2323", "032"]
|
234
|
+
it_splits '6285220119289', ['62', '852', '2011', '9289']
|
235
|
+
it_splits '62217815263', ['62', '21', '7815', '263']
|
236
|
+
it_splits '6213123', %w(62 13 123)
|
237
|
+
it_splits '6213123456', %w(62 13 123 456)
|
238
|
+
it_splits '6217412', %w(62 174 12)
|
239
|
+
it_splits '6217412345', %w(62 174 12 345)
|
240
|
+
it_splits '6217712', %w(62 177 12)
|
241
|
+
it_splits '6217712123456', %w(62 177 1212 3456)
|
242
|
+
it_splits '62178123', %w(62 178 123)
|
243
|
+
it_splits '6217812345', %w(62 178 123 45)
|
244
|
+
it_splits '622112345', %w(62 21 123 45)
|
245
|
+
it_splits '622112345567', %w(62 21 1234 5567)
|
246
|
+
it_splits '622212345', %w(62 22 123 45)
|
247
|
+
it_splits '62221234567', %w(62 22 123 4567)
|
248
|
+
it_splits '624311234', %w(62 4 311 234)
|
249
|
+
it_splits '62431123456', %w(62 4 3112 3456)
|
250
|
+
it_splits '6262212345', %w(62 6 221 2345)
|
251
|
+
it_splits '62622123456', %w(62 6 2212 3456)
|
252
|
+
it_splits '6270123456', %w(62 70 123 456)
|
253
|
+
it_splits '6271123456', %w(62 71 123 456)
|
254
|
+
it_splits '62711234567', %w(62 71 123 4567)
|
255
|
+
it_splits '62810123456', %w(62 810 123 456)
|
256
|
+
it_splits '6281012345678', %w(62 810 1234 5678)
|
257
|
+
it_splits '62820123456', %w(62 820 123 456)
|
258
|
+
it_splits '6287012345', %w(62 870 123 45)
|
259
|
+
it_splits '62877123456', %w(62 877 123 456)
|
260
|
+
it_splits '62881123456', %w(62 881 123 456)
|
261
|
+
it_splits '6288112345656', %w(62 881 1234 5656)
|
262
|
+
it_splits '6291234567', %w(62 9 1234 567)
|
263
|
+
it_splits '629123456789', %w(62 9 123 456 789)
|
264
|
+
end
|
265
|
+
|
266
|
+
describe 'India' do
|
267
|
+
it_splits '919911182111', ['91', '99', '111', '82', '111'] # mobile
|
268
|
+
it_splits '912212345678', ['91', '22', '123', '45', '678'] # New Delhi
|
269
|
+
it_splits '911411234567', ['91', '141', '123', '45', '67'] # Jaipur
|
270
|
+
it_splits '913525123456', ['91', '3525', '123', '456' ] # DALKHOLA
|
271
|
+
end
|
272
|
+
|
273
|
+
describe 'Iran' do
|
274
|
+
it_splits '982112341234', ['98', '21', '1234', '1234'] # Teheran
|
275
|
+
it_splits '989191231234', ['98', '919', '123', '1234'] # Example Cell Phone
|
155
276
|
end
|
277
|
+
|
156
278
|
describe 'Ireland' do
|
157
279
|
it_splits '35311234567', ['353', '1', '123', '4567'] # Dublin, 7 digit subscriber #
|
158
280
|
it_splits '3532212345', ['353', '22', '12345'] # Mallow, 5 digit subscriber #
|
@@ -162,16 +284,58 @@ describe 'country descriptions' do
|
|
162
284
|
it_splits '353800123456', ['353', '800', '123456'] # Freefone
|
163
285
|
it_splits '353000123456', ['353', '000', '123456'] # Default fixed 3 split for unrecognized
|
164
286
|
end
|
287
|
+
|
288
|
+
describe 'Israel (972)' do
|
289
|
+
it_splits '972100', ['972', '1', '00'] # Police
|
290
|
+
it_splits '97221231234', ['972', '2', '123', '1234'] # Jerusalem Area
|
291
|
+
it_splits '97282411234', ['972', '8', '241', '1234'] # Gaza Strip (Palestine)
|
292
|
+
it_splits '97291231234', ['972', '9', '123', '1234'] # Sharon Area
|
293
|
+
it_splits '972501231234', ['972', '50', '123', '1234'] # Mobile (Pelephone)
|
294
|
+
it_splits '972591231234', ['972', '59', '123', '1234'] # Mobile Jawwal (Palestine)
|
295
|
+
it_splits '972771231234', ['972', '77', '123', '1234'] # Cable Phone Services
|
296
|
+
it_splits '9721700123123', ['972', '1', '700', '123', '123'] # Cable Phone Services
|
297
|
+
end
|
298
|
+
describe 'Israel (970)' do
|
299
|
+
it_splits '97021231234', ['970', '2', '123', '1234'] # Jerusalem Area
|
300
|
+
it_splits '97082411234', ['970', '8', '241', '1234'] # Gaza Strip (Palestine)
|
301
|
+
it_splits '97091231234', ['970', '9', '123', '1234'] # Sharon Area
|
302
|
+
it_splits '970501231234', ['970', '50', '123', '1234'] # Mobile (Pelephone)
|
303
|
+
it_splits '970591231234', ['970', '59', '123', '1234'] # Mobile Jawwal (Palestine)
|
304
|
+
it_splits '970771231234', ['970', '77', '123', '1234'] # Cable Phone Services
|
305
|
+
it_splits '9701700123123', ['970', '1', '700', '123', '123'] # Cable Phone Services
|
306
|
+
end
|
165
307
|
describe 'Italy' do
|
166
|
-
it_splits '3934869528', ['39', '
|
308
|
+
it_splits '3934869528', ['39', '348', '695', '28'] # Mobile
|
309
|
+
it_splits '393357210488', ['39', '335', '721', '0488'] # Mobile
|
167
310
|
it_splits '390612341234', ['39', '06', '1234', '1234'] # Roma
|
311
|
+
it_splits '390288838883', ['39', '02', '8883', '8883'] # Milano
|
312
|
+
it_splits '390141595661', ['39', '0141', '595', '661'] # Asti
|
313
|
+
it_splits '3903123391', ['39', '031', '233', '91'] # Como
|
168
314
|
it_splits '390909709511', ['39', '090', '970', '9511'] # Barcellona
|
169
315
|
end
|
316
|
+
describe 'Japan' do
|
317
|
+
it_splits '81312345678', %w(81 3 1234 5678)
|
318
|
+
it_splits '81120123456', %w(81 120 123 456)
|
319
|
+
it_splits '81111234567', %w(81 11 1234 567)
|
320
|
+
it_splits '81123123456', %w(81 123 123 456)
|
321
|
+
it_splits '81126712345', %w(81 1267 123 45)
|
322
|
+
it_splits '819012345678', %w(81 90 1234 5678)
|
323
|
+
end
|
170
324
|
describe 'Kenya' do
|
171
325
|
it_splits '254201234567', ['254', '20', '1234567'] # Nairobi
|
172
326
|
it_splits '254111234567', ['254', '11', '1234567'] # Mombasa
|
173
327
|
it_splits '254723100220', ['254', '723', '100220'] # Mombasa
|
174
328
|
end
|
329
|
+
describe 'Kyrgyzstan' do
|
330
|
+
it_splits '996312212345', %w(996 312 212 345)
|
331
|
+
it_splits '996315212345', %w(996 315 212 345)
|
332
|
+
it_splits '996313121234', %w(996 3131 212 34)
|
333
|
+
it_splits '996394621234', %w(996 3946 212 34)
|
334
|
+
it_splits '996501234567', %w(996 50 123 4567)
|
335
|
+
it_splits '996521234567', %w(996 52 123 4567)
|
336
|
+
it_splits '996581234567', %w(996 58 123 4567)
|
337
|
+
it_splits '996800123456', %w(996 800 123 456)
|
338
|
+
end
|
175
339
|
describe 'Lithuania' do
|
176
340
|
it_splits '37070012123', ['370', '700', '12', '123'] # Service
|
177
341
|
it_splits '37061212123', ['370', '612', '12', '123'] # Mobile
|
@@ -189,10 +353,13 @@ describe 'country descriptions' do
|
|
189
353
|
it_splits '35227855', ['352', '27', '85', '5']
|
190
354
|
end
|
191
355
|
describe 'Malaysia' do
|
192
|
-
it_splits '6082123456',
|
193
|
-
it_splits '60312345678',
|
194
|
-
it_splits '60212345678',
|
195
|
-
|
356
|
+
it_splits '6082123456', ['60', '82', '123456'] # Kuching
|
357
|
+
it_splits '60312345678', ['60', '3', '12345678'] # Kuala Lumpur
|
358
|
+
it_splits '60212345678', ['60', '2', '12345678'] # Singapore
|
359
|
+
it_splits '60111231234', ['60', '11', '123', '1234'] # Mobile
|
360
|
+
it_splits '60800121234', ['60', '800', '12', '1234'] # Freephone
|
361
|
+
# it_splits '60112', ['60', '112'] # Service
|
362
|
+
end
|
196
363
|
describe 'Malta' do
|
197
364
|
it_splits '35621231234', ['356', '2123', '1234'] # Fixed
|
198
365
|
it_splits '35677123456', ['356', '77', '123456'] # Mobile
|
@@ -207,13 +374,30 @@ describe 'country descriptions' do
|
|
207
374
|
it_splits '37741123456', ['377', '41', '12', '34', '56'] # Mobile
|
208
375
|
it_splits '377612345678', ['377', '6', '12', '34', '56', '78'] # Mobile
|
209
376
|
end
|
377
|
+
describe 'Montenegro' do
|
378
|
+
it_splits '38280123456', %w(382 80 123 456)
|
379
|
+
it_splits '3822012345', %w(382 20 123 45)
|
380
|
+
it_splits '38220123456', %w(382 20 123 456)
|
381
|
+
it_splits '38232123456', %w(382 32 123 456)
|
382
|
+
it_splits '38278103456', %w(382 78 103 456)
|
383
|
+
it_splits '38263123', %w(382 63 123)
|
384
|
+
it_splits '382631234567890', %w(382 63 123 456 7890)
|
385
|
+
it_splits '38277103456', %w(382 77 103 456)
|
386
|
+
it_splits '38294103456', %w(382 94 103 456)
|
387
|
+
it_splits '38288103456', %w(382 88 103 456)
|
388
|
+
it_splits '3826812', %w(382 68 12)
|
389
|
+
it_splits '382681212345678', %w(382 68 12 1234 5678)
|
390
|
+
it_splits '38270123', %w(382 70 123)
|
391
|
+
it_splits '382701234567890', %w(382 70 123 456 7890)
|
392
|
+
end
|
210
393
|
describe 'Morocco' do
|
211
394
|
it_splits '212537718685', ['212', '53', '7718', '685']
|
395
|
+
it_splits '212612345678', ['212', '6', '12', '34', '56', '78']
|
212
396
|
end
|
213
397
|
describe 'The Netherlands' do
|
214
|
-
it_splits '31612345678', ['31', '6', '
|
215
|
-
it_splits '31201234567', ['31', '20', '
|
216
|
-
it_splits '31222123456', ['31', '222', '
|
398
|
+
it_splits '31612345678', ['31', '6', '12', '34', '56', '78'] # mobile
|
399
|
+
it_splits '31201234567', ['31', '20', '123', '4567']
|
400
|
+
it_splits '31222123456', ['31', '222', '123', '456']
|
217
401
|
end
|
218
402
|
describe 'Norway' do
|
219
403
|
it_splits '4721234567', ['47',false,'21','23','45','67']
|
@@ -225,11 +409,34 @@ describe 'country descriptions' do
|
|
225
409
|
it_splits '4781234567', ['47',false,'812','34','567']
|
226
410
|
it_splits '4791234567', ['47',false,'912','34','567']
|
227
411
|
end
|
412
|
+
describe 'Oman' do
|
413
|
+
it_splits '96824423123', %w(968 24 423 123)
|
414
|
+
it_splits '96825423123', %w(968 25 423 123)
|
415
|
+
end
|
416
|
+
describe 'Pakistan' do
|
417
|
+
it_splits '922112345678', %w(92 21 1234 5678)
|
418
|
+
it_splits '92221234567', %w(92 22 1234 567)
|
419
|
+
it_splits '92232123456', %w(92 232 123 456)
|
420
|
+
it_splits '923012345678', %w(92 30 1234 5678)
|
421
|
+
end
|
422
|
+
describe 'Paraguay (Republic of)' do
|
423
|
+
it_splits '59521123456', %w(595 21 123 456)
|
424
|
+
it_splits '595211234567', %w(595 21 123 4567)
|
425
|
+
it_splits '595345123456', %w(595 345 123 456)
|
426
|
+
it_splits '595961611234', %w(595 96 161 1234)
|
427
|
+
end
|
228
428
|
describe 'Peru' do
|
229
429
|
it_splits '51112341234', ['51', '1', '1234', '1234'] # Lima
|
230
430
|
it_splits '51912341234', ['51', '9', '1234', '1234'] # mobile
|
231
431
|
it_splits '51841234123', ['51', '84', '1234', '123'] # Cuzco, best effort
|
232
432
|
end
|
433
|
+
describe 'Philippines' do
|
434
|
+
it_splits '6321234567', ['63', '2', '1234567']
|
435
|
+
it_splits '6321234567890', ['63', '2', '1234567890']
|
436
|
+
it_splits '632123456789012', ['63', '2', '123456789012']
|
437
|
+
it_splits '639121234567', ['63', '912', '1234567']
|
438
|
+
it_splits '63881234567', ['63', '88', '1234567']
|
439
|
+
end
|
233
440
|
describe 'Poland' do
|
234
441
|
it_splits '48123456789', ['48', '12', '345', '67', '89'] # Landline
|
235
442
|
it_splits '48501123456', ['48', '501', '123', '456'] # Mobile
|
@@ -242,6 +449,16 @@ describe 'country descriptions' do
|
|
242
449
|
it_splits '351241123123', ['351', '241', '123', '123'] # Abrantes
|
243
450
|
it_splits '351931231234', ['351', '93', '123', '1234'] # mobile
|
244
451
|
end
|
452
|
+
describe 'Qatar' do
|
453
|
+
it_splits '9741245123456', %w(974 1245 123 456)
|
454
|
+
it_splits '9742613456', %w(974 26 134 56)
|
455
|
+
it_splits '97433123456', %w(974 33 123 456)
|
456
|
+
it_splits '97444412456', %w(974 44 412 456)
|
457
|
+
it_splits '9748001234', %w(974 800 12 34)
|
458
|
+
it_splits '9749001234', %w(974 900 12 34)
|
459
|
+
it_splits '97492123', %w(974 92 123)
|
460
|
+
it_splits '97497123', %w(974 97 123)
|
461
|
+
end
|
245
462
|
describe 'Romania' do
|
246
463
|
it_splits '40211231234', ['40', '21', '123', '1234'] # Bucureşti
|
247
464
|
it_splits '40721231234', ['40', '72', '123', '1234'] # mobile
|
@@ -263,23 +480,37 @@ describe 'country descriptions' do
|
|
263
480
|
it_splits '250251234567', ['250', '25', '1234567'] # fixed
|
264
481
|
it_splits '25006123456', ['250', '06', '123456'] # fixed
|
265
482
|
end
|
483
|
+
describe 'Sao Tome and Principe' do
|
484
|
+
it_splits '2392220012', %w(239 2 220 012)
|
485
|
+
it_splits '2399920012', %w(239 9 920 012)
|
486
|
+
end
|
266
487
|
describe 'South Korea' do
|
267
488
|
it { Phony.split('82212345678').should == ['82', '2', '1234', '5678'] } # Seoul
|
268
489
|
it { Phony.split('825112345678').should == ['82', '51', '1234', '5678'] } # Busan
|
269
490
|
it { Phony.split('821027975588').should == ['82', '10', '2797', '5588'] } # mobile
|
270
491
|
it { Phony.split('821087971234').should == ['82', '10', '8797', '1234'] } # mobile
|
271
492
|
end
|
493
|
+
describe 'South Sudan' do
|
494
|
+
it_splits '211123212345', ['211', '123', '212', '345']
|
495
|
+
it_splits '211973212345', ['211', '973', '212', '345']
|
496
|
+
end
|
272
497
|
describe 'Sudan' do
|
273
498
|
it_splits '249187171100', ['249', '18', '717', '1100']
|
274
499
|
end
|
275
500
|
describe 'Thailand' do
|
276
501
|
it { Phony.split('6621231234').should == ['66', '2', '123', '1234'] } # Bangkok
|
277
502
|
it { Phony.split('6636123123').should == ['66', '36', '123', '123'] } # Lop Buri
|
503
|
+
it { Phony.split('66851234567').should == ['66', '851', '234', '567'] } # Lop Buri
|
278
504
|
end
|
279
505
|
describe 'Tunesia' do
|
280
506
|
it { Phony.split('21611231234').should == ['216', '1', '123', '1234'] } # Ariana
|
281
507
|
it { Phony.split('21621231234').should == ['216', '2', '123', '1234'] } # Bizerte
|
282
508
|
end
|
509
|
+
describe 'Salvador (El)' do
|
510
|
+
it { Phony.split('50321121234').should == ['503', '2112', '1234'] } # Fixed number
|
511
|
+
it { Phony.split('50361121234').should == ['503', '6112', '1234'] } # Mobile number
|
512
|
+
end
|
513
|
+
|
283
514
|
describe 'Singapore' do
|
284
515
|
it { Phony.split('6561231234').should == ['65', false, '6123', '1234'] } # Fixed line
|
285
516
|
end
|
@@ -288,9 +519,15 @@ describe 'country descriptions' do
|
|
288
519
|
it { Phony.split('421212345678').should == ['421', '2', '12345678'] } # Bratislava
|
289
520
|
it { Phony.split('421371234567').should == ['421', '37', '1234567'] } # Nitra / Other
|
290
521
|
end
|
522
|
+
|
523
|
+
describe 'Sri Lanka' do
|
524
|
+
it { Phony.split('94711231212').should == ['94', '71', '123', '12', '12'] } # Mobile
|
525
|
+
end
|
526
|
+
|
291
527
|
describe 'Sweden' do
|
292
528
|
it { Phony.split('46812345678').should == ['46', '8', '12345678'] } # Stockholm
|
293
529
|
it { Phony.split('46111234567').should == ['46', '11', '1234567'] }
|
530
|
+
it { Phony.split('46721234567').should == ['46', '72', '1234567'] } # mobile
|
294
531
|
it { Phony.split('46125123456').should == ['46', '125', '123456'] }
|
295
532
|
end
|
296
533
|
describe 'Switzerland' do
|
@@ -356,6 +593,437 @@ describe 'country descriptions' do
|
|
356
593
|
describe 'New Zealand' do
|
357
594
|
it { Phony.split('6491234567').should == ['64', '9', '123', '4567'] }
|
358
595
|
end
|
596
|
+
describe 'Bhutan (Kingdom of)' do
|
597
|
+
it_splits '9759723642', %w(975 9 723 642)
|
598
|
+
end
|
599
|
+
describe 'Brunei Darussalam' do
|
600
|
+
it_splits '6737932744', %w(673 7 932 744)
|
601
|
+
end
|
602
|
+
describe 'Burkina Faso' do
|
603
|
+
it_splits '22667839323', ['226', false, '6783', '9323']
|
604
|
+
end
|
605
|
+
describe 'Burundi' do
|
606
|
+
it_splits '25712345678', ['257', false, '1234', '5678']
|
607
|
+
end
|
608
|
+
describe 'Cameroon' do
|
609
|
+
it_splits '23727659381', ['237', false, '2765', '9381']
|
610
|
+
end
|
611
|
+
describe 'Cape Verde' do
|
612
|
+
it_splits '2385494177', ['238', false, '549', '4177']
|
613
|
+
end
|
614
|
+
describe 'Central African Republic' do
|
615
|
+
it_splits '23612345678', ['236', false, '1234', '5678']
|
616
|
+
end
|
617
|
+
describe 'Chad' do
|
618
|
+
it_splits '23512345678', ['235', false, '1234', '5678']
|
619
|
+
end
|
620
|
+
describe 'Comoros' do
|
621
|
+
it_splits '2693901234', ['269', false, '3901', '234']
|
622
|
+
it_splits '2693401234', ['269', false, '3401', '234']
|
623
|
+
end
|
624
|
+
describe 'Congo' do
|
625
|
+
it_splits '242123456789', ['242', false, '1234', '56789']
|
626
|
+
end
|
627
|
+
describe 'Cook Islands' do
|
628
|
+
it_splits '68251475', ['682', false, '51', '475']
|
629
|
+
end
|
630
|
+
describe 'Costa Rica' do
|
631
|
+
it_splits '50622345678', %w(506 2 234 5678)
|
632
|
+
end
|
633
|
+
describe "Côte d'Ivoire" do
|
634
|
+
it_splits '22537335518', ['225', false, '3733', '5518']
|
635
|
+
end
|
636
|
+
describe 'Democratic Republic of Timor-Leste' do
|
637
|
+
it_splits '6701742945', ['670', false, '174', '2945']
|
638
|
+
end
|
639
|
+
describe 'Democratic Republic of the Congo' do
|
640
|
+
it_splits '24311995381', %w(243 1 199 5381)
|
641
|
+
end
|
642
|
+
describe 'Diego Garcia' do
|
643
|
+
it_splits '2461234683', ['246', false, '123', '4683']
|
644
|
+
end
|
645
|
+
describe 'Djibouti' do
|
646
|
+
it_splits '25349828978', ['253', false, '4982', '8978']
|
647
|
+
end
|
648
|
+
describe 'Ecuador' do
|
649
|
+
it_splits '593445876756', %w(593 44 587 6756)
|
650
|
+
end
|
651
|
+
describe 'Eritrea' do
|
652
|
+
it_splits '2916537192', %w(291 6 537 192)
|
653
|
+
end
|
654
|
+
describe 'Ethiopia' do
|
655
|
+
it_splits '251721233486', %w(251 72 123 3486)
|
656
|
+
end
|
657
|
+
describe 'Falkland Islands (Malvinas)' do
|
658
|
+
it_splits '50014963', ['500', false, '14', '963']
|
659
|
+
end
|
660
|
+
describe 'Faroe Islands' do
|
661
|
+
it_splits '298997986', ['298', false, '997', '986']
|
662
|
+
end
|
663
|
+
describe 'Fiji (Republic of)' do
|
664
|
+
it_splits '6798668123', ['679', false, '866', '8123']
|
665
|
+
end
|
666
|
+
describe 'French Guiana (French Department of)' do
|
667
|
+
it_splits '594594123456', %w(594 594 123 456)
|
668
|
+
end
|
669
|
+
describe "French Polynesia (Territoire français d'outre-mer)" do
|
670
|
+
it_splits '689219889', ['689', false, '219', '889']
|
671
|
+
end
|
672
|
+
describe 'Gabonese Republic' do
|
673
|
+
it_splits '2411834375', ['241', '1', '834', '375']
|
674
|
+
end
|
675
|
+
describe 'Gambia' do
|
676
|
+
it_splits '2206683355', ['220', false, '668', '3355']
|
677
|
+
end
|
678
|
+
describe 'Greenland' do
|
679
|
+
it_splits '299314185', ['299', '31', '4185']
|
680
|
+
it_splits '299691123', ['299', '691', '123']
|
681
|
+
end
|
682
|
+
describe 'Guadeloupe (French Department of)' do
|
683
|
+
it_splits '590123456789', %w(590 123 456 789)
|
684
|
+
end
|
685
|
+
describe 'Guatemala (Republic of)' do
|
686
|
+
it_splits '50219123456789', ['502', '19', '123', '456', '789']
|
687
|
+
it_splits '50221234567', ['502', '2', '123', '4567']
|
688
|
+
end
|
689
|
+
describe 'Guinea' do
|
690
|
+
it_splits '22412345678', ['224', false, '1234', '5678']
|
691
|
+
end
|
692
|
+
describe 'Guinea-Bissau' do
|
693
|
+
it_splits '2453837652', ['245', false, '383', '7652']
|
694
|
+
end
|
695
|
+
describe 'Guyana' do
|
696
|
+
it_splits '5922631234', %w(592 263 1234)
|
697
|
+
end
|
698
|
+
describe 'Honduras (Republic of)' do
|
699
|
+
it_splits '50412961637', %w(504 12 961 637)
|
700
|
+
end
|
701
|
+
describe 'Iraq' do
|
702
|
+
it_splits '96411234567', %w(964 1 123 4567)
|
703
|
+
it_splits '96421113456', %w(964 21 113 456)
|
704
|
+
it_splits '9647112345678', %w(964 71 1234 5678)
|
705
|
+
end
|
706
|
+
describe 'Jordan (Hashemite Kingdom of)' do
|
707
|
+
it_splits '96280012345', %w(962 800 123 45)
|
708
|
+
it_splits '96226201234', %w(962 2 620 1234)
|
709
|
+
it_splits '962712345678', %w(962 7 1234 5678)
|
710
|
+
it_splits '962746612345', %w(962 7 4661 2345)
|
711
|
+
it_splits '96290012345', %w(962 900 123 45)
|
712
|
+
it_splits '96285123456', %w(962 85 123 456)
|
713
|
+
it_splits '96270123456', %w(962 70 123 456)
|
714
|
+
it_splits '96262501456', %w(962 6250 1456)
|
715
|
+
it_splits '96287901456', %w(962 8790 1456)
|
716
|
+
end
|
717
|
+
describe 'Kiribati (Republic of)' do
|
718
|
+
it_splits '68634814', ['686', false, '34', '814']
|
719
|
+
end
|
720
|
+
describe "Democratic People's Republic of Korea" do
|
721
|
+
it_splits '850212345', %w(850 2 123 45)
|
722
|
+
it_splits '8502123456789', %w(850 2 123 456 789)
|
723
|
+
it_splits '85023812356', %w(850 2 381 2356)
|
724
|
+
#it_splits '85028801123456781256', %w(850 2 8801 1234 5678 1256)
|
725
|
+
it_splits '8501911234567', %w(850 191 123 4567)
|
726
|
+
end
|
727
|
+
describe 'Kuwait (State of)' do
|
728
|
+
it_splits '96523456789', ['965', false, '2345', '6789']
|
729
|
+
it_splits '9651812345', ['965', false, '181', '2345']
|
730
|
+
end
|
731
|
+
describe "Lao People's Democratic Republic" do
|
732
|
+
it_splits '85697831195', %w(856 97 831 195)
|
733
|
+
end
|
734
|
+
describe 'Latvia' do
|
735
|
+
it_splits '37180123456', %w(371 801 234 56)
|
736
|
+
it_splits '37163723456', %w(371 637 234 56)
|
737
|
+
it_splits '37129412345', %w(371 294 123 45)
|
738
|
+
end
|
739
|
+
describe 'Lebanon' do
|
740
|
+
it_splits '9611123456', %w(961 1 123 456)
|
741
|
+
it_splits '9614123456', %w(961 4 123 456)
|
742
|
+
it_splits '9613123456', %w(961 3 123 456)
|
743
|
+
it_splits '96170123456', %w(961 70 123 456)
|
744
|
+
it_splits '96190123456', %w(961 90 123 456)
|
745
|
+
it_splits '96181123456', %w(961 81 123 456)
|
746
|
+
end
|
747
|
+
describe 'Lesotho' do
|
748
|
+
it_splits '26623592495', ['266', false, '2359', '2495']
|
749
|
+
end
|
750
|
+
describe 'Liberia' do
|
751
|
+
it_splits '23121234567', ['231', false, '2123', '4567']
|
752
|
+
it_splits '2314123456', ['231', false, '4123', '456']
|
753
|
+
end
|
754
|
+
describe 'Libya' do
|
755
|
+
it_splits '21820512345', %w(218 205 123 45)
|
756
|
+
it_splits '21822123456', %w(218 22 123 456)
|
757
|
+
it_splits '218211234456', %w(218 21 1234 456)
|
758
|
+
it_splits '218911234456', %w(218 91 1234 456)
|
759
|
+
end
|
760
|
+
describe 'Madagascar' do
|
761
|
+
it_splits '26120012345678', ['261', false, '20', '012', '345', '678']
|
762
|
+
it_splits '261201243456', ['261', false, *%w(20 124 3456)]
|
763
|
+
it_splits '261512345678', ['261', false, *%w(512 345 678)]
|
764
|
+
end
|
765
|
+
describe 'Malawi' do
|
766
|
+
it_splits '2651725123', ['265', false, '1725', '123']
|
767
|
+
it_splits '265213456789',[ '265', false, '213', '456', '789']
|
768
|
+
it_splits '2659123456', ['265', false, '9123', '456']
|
769
|
+
it_splits '265991123456', ['265', false, '991', '123', '456']
|
770
|
+
end
|
771
|
+
describe 'Maldives (Republic of)' do
|
772
|
+
it_splits '9606568279', ['960', '656', '8279']
|
773
|
+
end
|
774
|
+
describe 'Mali' do
|
775
|
+
it_splits '22379249349', ['223', false, '7924', '9349']
|
776
|
+
end
|
777
|
+
describe 'Marshall Islands (Republic of the)' do
|
778
|
+
it_splits '6924226536', ['692', false, '422', '6536']
|
779
|
+
end
|
780
|
+
describe 'Martinique (French Department of)' do
|
781
|
+
it_splits '596596123456', %w(596 596 123 456)
|
782
|
+
end
|
783
|
+
describe 'Mauritania' do
|
784
|
+
it_splits '22212345678', ['222', false, '1234', '5678']
|
785
|
+
end
|
786
|
+
describe 'Mauritius' do
|
787
|
+
it_splits '2309518919', ['230', false, '951', '8919']
|
788
|
+
end
|
789
|
+
describe 'Micronesia (Federated States of)' do
|
790
|
+
it_splits '6911991754', ['691', false, '199', '1754']
|
791
|
+
end
|
792
|
+
describe 'Moldova' do
|
793
|
+
it_splits '37380012345', %w(373 800 123 45)
|
794
|
+
it_splits '37322123345', %w(373 22 123 345)
|
795
|
+
it_splits '37324112345', %w(373 241 123 45)
|
796
|
+
it_splits '37360512345', %w(373 605 123 45)
|
797
|
+
it_splits '37380312345', %w(373 803 123 45)
|
798
|
+
end
|
799
|
+
describe 'Mongolia' do
|
800
|
+
it_splits '9761112345', %w(976 11 123 45)
|
801
|
+
it_splits '9761211234', %w(976 121 12 34)
|
802
|
+
it_splits '97612112345', %w(976 121 12 345)
|
803
|
+
it_splits '97670123456', %w(976 70 123 456)
|
804
|
+
it_splits '97675123456', %w(976 75 123 456)
|
805
|
+
it_splits '97688123456', %w(976 88 123 456)
|
806
|
+
it_splits '97650123456', %w(976 50 123 456)
|
807
|
+
end
|
808
|
+
describe 'Mozambique' do
|
809
|
+
it_splits '258600123456', %w(258 600 123 456)
|
810
|
+
it_splits '25825112345', %w(258 251 123 45)
|
811
|
+
it_splits '258821234456', %w(258 82 1234 456)
|
812
|
+
it_splits '258712344567', %w(258 7 1234 4567)
|
813
|
+
end
|
814
|
+
describe 'Namibia' do
|
815
|
+
it_splits '264675161324', %w(264 6751 613 24)
|
816
|
+
it_splits '26467175890', %w(264 67 175 890)
|
817
|
+
it_splits '26463088612345', %w(264 63 088 612 345)
|
818
|
+
it_splits '264851234567', %w(264 85 1234 567)
|
819
|
+
end
|
820
|
+
describe 'Nauru (Republic of)' do
|
821
|
+
it_splits '6741288739', ['674', false, '128', '8739']
|
822
|
+
end
|
823
|
+
describe 'Nepal' do
|
824
|
+
it_splits '97714345678', %w(977 1 434 5678)
|
825
|
+
it_splits '97710123456', %w(977 10 123 456)
|
826
|
+
it_splits '9779812345678', %w(977 98 1234 5678)
|
827
|
+
end
|
828
|
+
describe "New Caledonia (Territoire français d'outre-mer)" do
|
829
|
+
it_splits '687747184', ['687', false, '747', '184']
|
830
|
+
end
|
831
|
+
describe 'Nicaragua' do
|
832
|
+
it_splits '50512345678', ['505', '12', '345', '678']
|
833
|
+
end
|
834
|
+
describe 'Niger' do
|
835
|
+
it_splits '22712345678', ['227', false, '1234', '5678']
|
836
|
+
end
|
837
|
+
describe 'Niue' do
|
838
|
+
it_splits '6833651', ['683', false, '3651']
|
839
|
+
end
|
840
|
+
describe 'Palau (Republic of)' do
|
841
|
+
it_splits '6804873653', ['680', false, '487', '3653']
|
842
|
+
end
|
843
|
+
describe 'Panama (Republic of)' do
|
844
|
+
it_splits '5078001234', %w(507 800 1234)
|
845
|
+
it_splits '50761234567', %w(507 6 123 4567)
|
846
|
+
it_splits '5072123456', %w(507 2 123 456)
|
847
|
+
end
|
848
|
+
describe 'Papua New Guinea' do
|
849
|
+
it_splits '6753123567', %w(675 3 123 567)
|
850
|
+
it_splits '6751801234', %w(675 180 1234)
|
851
|
+
it_splits '67580123456', %w(675 80 123 456)
|
852
|
+
it_splits '67591123456', %w(675 91 123 456)
|
853
|
+
it_splits '6751612345', %w(675 16 123 45)
|
854
|
+
it_splits '67518412345678', %w(675 184 1234 5678)
|
855
|
+
it_splits '67517012', %w(675 170 12)
|
856
|
+
it_splits '6751891', %w(675 189 1)
|
857
|
+
it_splits '6752701234', %w(675 270 1234)
|
858
|
+
it_splits '6752751234', %w(675 275 1234)
|
859
|
+
it_splits '67527912', %w(675 279 12)
|
860
|
+
it_splits '67511512345678', %w(675 115 1234 5678)
|
861
|
+
end
|
862
|
+
describe 'Reunion / Mayotte (new)' do
|
863
|
+
it_splits '2625943992657', ['262', false, '59439', '92657']
|
864
|
+
end
|
865
|
+
describe 'Saint Helena' do
|
866
|
+
it_splits '2903614', ['290', false, '3614']
|
867
|
+
end
|
868
|
+
describe 'Saint Pierre and Miquelon (Collectivité territoriale de la République française)' do
|
869
|
+
it_splits '508418826', ['508', false, '418', '826']
|
870
|
+
end
|
871
|
+
describe 'Samoa (Independent State of)' do
|
872
|
+
it_splits '685800123', ['685', false, '800', '123']
|
873
|
+
it_splits '68561123', ['685', false, '61', '123']
|
874
|
+
it_splits '6857212345', ['685', false, '721', '2345']
|
875
|
+
it_splits '685830123', ['685', false, '830', '123']
|
876
|
+
it_splits '685601234', ['685', false, '601', '234']
|
877
|
+
it_splits '6858412345', ['685', false, '841', '2345']
|
878
|
+
end
|
879
|
+
describe 'San Marino' do
|
880
|
+
it_splits '378800123', ['378', false, '800', '123']
|
881
|
+
it_splits '3788001234567', ['378', false, '800', '123', '4567']
|
882
|
+
it_splits '378012345', ['378', false, '012', '345']
|
883
|
+
it_splits '3780123456789', ['378', false, '012', '345', '6789']
|
884
|
+
it_splits '378512345', ['378', false, '512', '345']
|
885
|
+
it_splits '3785123456789', ['378', false, '512', '345', '6789']
|
886
|
+
end
|
887
|
+
describe 'Saudi Arabia (Kingdom of)' do
|
888
|
+
it_splits '96628528423', %w(966 2 852 8423)
|
889
|
+
end
|
890
|
+
describe 'Senegal' do
|
891
|
+
it_splits '221123456789', ['221', false, '1234', '56789']
|
892
|
+
end
|
893
|
+
describe 'Serbia' do
|
894
|
+
it_splits '38180012345', %w(381 800 123 45)
|
895
|
+
it_splits '3811012345', %w(381 10 123 45)
|
896
|
+
it_splits '38110123456', %w(381 10 123 456)
|
897
|
+
it_splits '38111123456', %w(381 11 123 456)
|
898
|
+
it_splits '381111234567', %w(381 11 123 4567)
|
899
|
+
it_splits '381721234567', %w(381 72 123 4567)
|
900
|
+
it_splits '38160123', %w(381 60 123)
|
901
|
+
it_splits '381601234567', %w(381 60 123 4567)
|
902
|
+
it_splits '38142123456', %w(381 42 123 456)
|
903
|
+
it_splits '38191234567', %w(381 9 123 4567)
|
904
|
+
it_splits '38160123', %w(381 60 123)
|
905
|
+
it_splits '381601234567890', %w(381 60 123 456 7890)
|
906
|
+
it_splits '38170123456', %w(381 70 123 456)
|
907
|
+
end
|
908
|
+
describe 'Sierra Leone' do
|
909
|
+
it_splits '23264629769', %w(232 64 629 769)
|
910
|
+
end
|
911
|
+
describe 'Solomon Islands' do
|
912
|
+
it_splits '67754692', ['677', false, '54', '692']
|
913
|
+
it_splits '6777546921', ['677', false, '7546', '921']
|
914
|
+
end
|
915
|
+
describe 'Somali Democratic Republic' do
|
916
|
+
it_splits '252103412345', %w(252 1034 123 45)
|
917
|
+
it_splits '2521313123', %w(252 1313 123)
|
918
|
+
it_splits '2521601234', %w(252 160 12 34)
|
919
|
+
it_splits '25250012345', %w(252 500 123 45)
|
920
|
+
it_splits '252671234567', %w(252 67 1234 567)
|
921
|
+
end
|
922
|
+
describe 'Suriname (Republic of)' do
|
923
|
+
it_splits '597958434', ['597', false, '958', '434']
|
924
|
+
|
925
|
+
it_splits '597212345', ['597', false, '212', '345']
|
926
|
+
it_splits '5976123456', ['597', false, '612', '3456']
|
927
|
+
end
|
928
|
+
describe 'Swaziland' do
|
929
|
+
it_splits '26822071234', ['268', false, '2207', '1234']
|
930
|
+
it_splits '2685501234', ['268', false, '550', '1234']
|
931
|
+
end
|
932
|
+
describe 'Syrian Arab Republic' do
|
933
|
+
it_splits '963111234567', %w(963 11 123 4567)
|
934
|
+
it_splits '963311234567', %w(963 31 123 4567)
|
935
|
+
it_splits '96315731234', %w(963 15 731 234)
|
936
|
+
it_splits '963912345678', %w(963 9 1234 5678)
|
937
|
+
end
|
938
|
+
describe 'Taiwan' do
|
939
|
+
it_splits '88618123456', %w(886 18 123 456)
|
940
|
+
it_splits '8866121234567', %w(886 612 123 4567)
|
941
|
+
it_splits '886212345678', %w(886 2 1234 5678)
|
942
|
+
it_splits '88631234567', %w(886 3 123 4567)
|
943
|
+
it_splits '88633123456', %w(886 33 123 456)
|
944
|
+
it_splits '88682712345', %w(886 827 123 45)
|
945
|
+
it_splits '8864121234', %w(886 412 1234)
|
946
|
+
it_splits '88690123456', %w(886 90 123 456)
|
947
|
+
it_splits '886901234567', %w(886 90 123 4567)
|
948
|
+
it_splits '88694991345', %w(886 94 991 345)
|
949
|
+
end
|
950
|
+
describe 'Togolese Republic' do
|
951
|
+
it_splits '22812345678', ['228', false, '1234', '5678']
|
952
|
+
end
|
953
|
+
describe 'Tajikistan' do
|
954
|
+
it_splits '992313012345', %w(992 3130 123 45)
|
955
|
+
it_splits '992331700123', %w(992 331700 123)
|
956
|
+
it_splits '992372123345', %w(992 372 123 345)
|
957
|
+
it_splits '992505123456', %w(992 505 123 456)
|
958
|
+
it_splits '992973123456', %w(992 973 123 456)
|
959
|
+
it_splits '992474456123', %w(992 474 456 123)
|
960
|
+
end
|
961
|
+
describe 'Tokelau' do
|
962
|
+
it_splits '6901371', %w(690 1 371)
|
963
|
+
end
|
964
|
+
describe 'Tonga (Kingdom of)' do
|
965
|
+
it_splits '67620123', ['676', false, '20', '123']
|
966
|
+
it_splits '67684123', ['676', false, '84', '123']
|
967
|
+
it_splits '6767712345', ['676', false, '77', '123', '45']
|
968
|
+
it_splits '6768912345', ['676', false, '89', '123', '45']
|
969
|
+
end
|
970
|
+
describe 'Tuvalu' do
|
971
|
+
it_splits '68893741', ['688', false, '93741']
|
972
|
+
end
|
973
|
+
describe 'Turkmenistan' do
|
974
|
+
it_splits '99312456789', %w(993 12 456 789)
|
975
|
+
it_splits '99313145678', %w(993 131 456 78)
|
976
|
+
it_splits '99313924567', %w(993 1392 4567)
|
977
|
+
it_splits '99361234567', %w(993 6 123 4567)
|
978
|
+
end
|
979
|
+
describe 'Ukraine' do
|
980
|
+
it_splits '380800123456', %w(380 800 123 456)
|
981
|
+
it_splits '380312123456', %w(380 312 123 456)
|
982
|
+
it_splits '380320123456', %w(380 32 0123 456)
|
983
|
+
it_splits '380325912345', %w(380 3259 123 45)
|
984
|
+
it_splits '380326061234', %w(380 32606 1234)
|
985
|
+
it_splits '380981234567', %w(380 981 234 567)
|
986
|
+
end
|
987
|
+
describe 'United Arab Emirates' do
|
988
|
+
it_splits '97180012', %w(971 800 12)
|
989
|
+
it_splits '971800123456789', %w(971 800 12 345 6789)
|
990
|
+
it_splits '97121234567', %w(971 2 123 4567)
|
991
|
+
it_splits '971506412345', %w(971 50 641 2345)
|
992
|
+
it_splits '971600641234', %w(971 600 641 234)
|
993
|
+
it_splits '971500641234', %w(971 500 641 234)
|
994
|
+
it_splits '971200641234', %w(971 200 641 234)
|
995
|
+
end
|
996
|
+
describe 'Uruguay (Eastern Republic of)' do
|
997
|
+
it_splits '59880012345', %w(598 800 123 45)
|
998
|
+
it_splits '59820123456', %w(598 2 012 3456)
|
999
|
+
it_splits '59821123456', %w(598 21 123 456)
|
1000
|
+
it_splits '59890912345', %w(598 909 123 45)
|
1001
|
+
it_splits '59893123456', %w(598 93 123 456)
|
1002
|
+
it_splits '59890812345', %w(598 908 123 45)
|
1003
|
+
it_splits '59880512345', %w(598 805 123 45)
|
1004
|
+
end
|
1005
|
+
describe 'Uzbekistan (Republic of)' do
|
1006
|
+
it_splits '998433527869', %w(998 43 352 7869)
|
1007
|
+
end
|
1008
|
+
describe 'Vanuatu (Republic of)' do
|
1009
|
+
it_splits '67889683', ['678', false, '89', '683']
|
1010
|
+
end
|
1011
|
+
describe 'Yemen' do
|
1012
|
+
it_splits '9671234567', %w(967 1 234 567)
|
1013
|
+
it_splits '96712345678', %w(967 1 234 5678)
|
1014
|
+
it_splits '9677234567', %w(967 7 234 567)
|
1015
|
+
it_splits '967771234567', %w(967 77 123 4567)
|
1016
|
+
it_splits '967581234', %w(967 58 1234)
|
1017
|
+
end
|
1018
|
+
describe 'Zimbabwe' do
|
1019
|
+
it_splits '2632582123456', %w(263 2582 123 456)
|
1020
|
+
it_splits '2632582123', %w(263 2582 123)
|
1021
|
+
it_splits '263147123456', %w(263 147 123 456)
|
1022
|
+
it_splits '263147123', %w(263 147 123)
|
1023
|
+
it_splits '263270123456', %w(263 270 123 456)
|
1024
|
+
it_splits '26327012345', %w(263 270 123 45)
|
1025
|
+
it_splits '2638612354567', %w(263 86 1235 4567)
|
1026
|
+
end
|
359
1027
|
end
|
360
1028
|
|
361
1029
|
end
|