phony 2.15.0 → 2.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. checksums.yaml +5 -5
  2. data/README.textile +35 -7
  3. data/lib/phony/config.rb +91 -0
  4. data/lib/phony/countries/argentina.rb +355 -0
  5. data/lib/phony/countries/austria.rb +34 -24
  6. data/lib/phony/countries/bangladesh.rb +2 -0
  7. data/lib/phony/countries/belarus.rb +2 -0
  8. data/lib/phony/countries/brazil.rb +6 -4
  9. data/lib/phony/countries/cambodia.rb +6 -4
  10. data/lib/phony/countries/china.rb +7 -2
  11. data/lib/phony/countries/croatia.rb +13 -16
  12. data/lib/phony/countries/georgia.rb +6 -4
  13. data/lib/phony/countries/germany.rb +5 -2
  14. data/lib/phony/countries/guinea.rb +8 -5
  15. data/lib/phony/countries/india.rb +2 -0
  16. data/lib/phony/countries/indonesia.rb +8 -3
  17. data/lib/phony/countries/ireland.rb +27 -23
  18. data/lib/phony/countries/italy.rb +30 -17
  19. data/lib/phony/countries/japan.rb +61 -8
  20. data/lib/phony/countries/kyrgyzstan.rb +2 -0
  21. data/lib/phony/countries/latvia.rb +2 -0
  22. data/lib/phony/countries/libya.rb +3 -1
  23. data/lib/phony/countries/malaysia.rb +22 -2
  24. data/lib/phony/countries/moldova.rb +2 -0
  25. data/lib/phony/countries/montenegro.rb +2 -0
  26. data/lib/phony/countries/myanmar.rb +2 -0
  27. data/lib/phony/countries/namibia.rb +2 -0
  28. data/lib/phony/countries/nepal.rb +2 -0
  29. data/lib/phony/countries/netherlands.rb +5 -1
  30. data/lib/phony/countries/pakistan.rb +2 -0
  31. data/lib/phony/countries/paraguay.rb +2 -0
  32. data/lib/phony/countries/russia_kazakhstan_abkhasia_south_ossetia.rb +24 -14
  33. data/lib/phony/countries/saudi_arabia.rb +40 -0
  34. data/lib/phony/countries/serbia.rb +10 -4
  35. data/lib/phony/countries/somalia.rb +5 -1
  36. data/lib/phony/countries/south_korea.rb +16 -9
  37. data/lib/phony/countries/sweden.rb +53 -38
  38. data/lib/phony/countries/taiwan.rb +22 -46
  39. data/lib/phony/countries/tajikistan.rb +2 -0
  40. data/lib/phony/countries/turkmenistan.rb +2 -0
  41. data/lib/phony/countries/ukraine.rb +5 -2
  42. data/lib/phony/countries/united_kingdom.rb +5 -2
  43. data/lib/phony/countries/uruguay.rb +2 -0
  44. data/lib/phony/countries/vietnam.rb +94 -92
  45. data/lib/phony/countries/zimbabwe.rb +2 -0
  46. data/lib/phony/countries.rb +210 -98
  47. data/lib/phony/country.rb +15 -3
  48. data/lib/phony/country_codes.rb +17 -4
  49. data/lib/phony/dsl.rb +5 -3
  50. data/lib/phony/local_splitters/fixed.rb +2 -0
  51. data/lib/phony/national_code.rb +1 -1
  52. data/lib/phony/national_splitters/none.rb +1 -3
  53. data/lib/phony/trunk_code.rb +5 -4
  54. data/lib/phony/vanity.rb +1 -1
  55. data/lib/phony.rb +94 -59
  56. data/spec/functional/config_spec.rb +44 -0
  57. data/spec/functional/plausibility_spec.rb +373 -35
  58. data/spec/lib/phony/countries_spec.rb +295 -63
  59. data/spec/lib/phony/country_codes_spec.rb +106 -33
  60. data/spec/lib/phony/country_spec.rb +54 -15
  61. data/spec/lib/phony/dsl_spec.rb +2 -2
  62. data/spec/lib/phony/local_splitters/regex_spec.rb +12 -5
  63. data/spec/lib/phony/national_splitters/default_spec.rb +1 -1
  64. data/spec/lib/phony/trunk_code_spec.rb +85 -0
  65. data/spec/lib/phony/vanity_spec.rb +30 -0
  66. data/spec/lib/phony_spec.rb +70 -0
  67. metadata +27 -17
@@ -21,30 +21,40 @@ describe 'country descriptions' do
21
21
  it_splits '93201234567', ['93', '20', '1234567'] # Kabul
22
22
  end
23
23
 
24
+ describe 'Albania' do
25
+ it_splits '355691234567', ['355', '69', '123', '4567'] # Mobile 7 digits
26
+ it_splits '35569123456', ['355', '69', '123', '456'] # Mobile 6 digits
27
+ it_splits '35541234567', ['355', '4', '123', '4567'] # Tirana
28
+ end
29
+
24
30
  describe 'Algeria' do
25
31
  it_splits '213211231234', ['213', '21', '123', '1234'] # Algiers
26
32
  it_splits '213331231234', ['213', '33', '123', '1234'] # Batna
27
33
  end
28
34
 
29
35
  describe 'Argentina' do
30
- it_splits '541112345678', ['54', '11', '1234', '5678']
31
- it_splits '542911234567', ['54', '291', '123', '4567']
32
- it_splits '542965123456', ['54', '2965', '12', '3456']
33
- it_splits '5491112345678', ['54', '911', '1234', '5678']
34
- it_splits '5492201234567', ['54', '9220', '123', '4567']
35
- it_splits '5492221123456', ['54', '92221', '12', '3456']
36
- it_splits '548001234567', ['54', '800', '123', '4567']
36
+ it_splits '541112345678', ['54', '11', '1234', '5678'] # 2-digit area code / landline
37
+ it_splits '542911234567', ['54', '291', '123', '4567'] # 3-digit area code / landline
38
+ it_splits '542903123456', ['54', '2903', '12', '3456'] # 4-digit area code / landline
39
+ it_splits '5491112345678', ['54', '911', '1234', '5678'] # 2-digit area code / international mobile
40
+ it_splits '5492201234567', ['54', '9220', '123', '4567'] # 3-digit area code / international mobile
41
+ it_splits '5492221123456', ['54', '92221', '12', '3456'] # 4-digit area code / international mobile
42
+ it_splits '548001234567', ['54', '800', '123', '4567'] # Non-geographic number
37
43
  end
38
44
 
39
45
  describe 'Austria' do
40
46
  it_splits '43198110', %w( 43 1 98110 ) # Vienna
41
47
  it_splits '4310000000', %w( 43 1 0000000 ) # Vienna
42
48
  it_splits '43800123456789', %w( 43 800 123456789 ) # Free
49
+ it_splits '436780000000', %w( 43 678 0000 000 ) # Mobile
43
50
  it_splits '4368100000000', %w( 43 681 0000 0000 ) # Mobile
44
51
  it_splits '436880000000', %w( 43 688 0000 000 ) # Mobile
45
52
  it_splits '4366900000000', %w( 43 669 0000 0000 ) # Mobile
53
+ it_splits '4367000000000', %w( 43 670 0000 0000 ) # Mobile
54
+ it_splits '4369000000000', %w( 43 690 0000 0000 ) # Mobile
46
55
  it_splits '433161234567891', %w( 43 316 1234567891 ) # Graz
47
56
  it_splits '432164123456789', %w( 43 2164 123456789 ) # Rohrau
57
+ it_splits '43720116987', %w( 43 720 116987 ) # VoIP
48
58
 
49
59
  # mobile numbers can have from 7 to 10 digits in the subscriber number
50
60
  it_splits '436641234567', %w( 43 664 1234 567 )
@@ -56,6 +66,9 @@ describe 'country descriptions' do
56
66
  describe 'Australia' do
57
67
  it_splits '61512341234', ['61', '5', '1234', '1234'] # Landline
58
68
  it_splits '61423123123', ['61', '423', '123', '123'] # Mobile
69
+ it_splits '61131212', ['61', '13', '12', '12'] # 13 local rate
70
+ it_splits '611300123123', ['61', '1300', '123', '123'] # 1300 local rate
71
+ it_splits '611800123123', ['61', '1800', '123', '123'] # 1800 free call
59
72
  end
60
73
 
61
74
  describe 'Bahrain' do
@@ -90,9 +103,21 @@ describe 'country descriptions' do
90
103
  it_splits '3295551914', ['32', '9', '555', '19', '14'] # Gent
91
104
  it_splits '3245551414', ['32', '4', '555', '14', '14'] # Liège
92
105
  it_splits '3216473200', ['32', '16', '47', '32', '00'] # Leuven
93
- it_splits '32475279584', ['32', '475', '27', '95', '84'] # mobile
94
- it_splits '32468279584', ['32', '468', '27', '95', '84'] # mobile (Telenet)
106
+ it_splits '32455123456', ['32', '455', '12', '34', '56'] # mobile (Voo)
107
+ it_splits '32456123456', ['32', '456', '12', '34', '56'] # mobile (MobileViking)
108
+ it_splits '32460123456', ['32', '460', '12', '34', '56'] # mobile (Proximus)
109
+ it_splits '32465123456', ['32', '465', '12', '34', '56'] # mobile (Lycamobile)
110
+ it_splits '32466123456', ['32', '466', '12', '34', '56'] # mobile (Vectone)
111
+ it_splits '32467123456', ['32', '467', '12', '34', '56'] # mobile (Telenet)
112
+ it_splits '32468123456', ['32', '468', '12', '34', '56'] # mobile (Telenet)
113
+ it_splits '32469123456', ['32', '469', '12', '34', '56'] # mobile ()
114
+ it_splits '32475123456', ['32', '475', '12', '34', '56'] # mobile (Proximus)
115
+ it_splits '32485123456', ['32', '485', '12', '34', '56'] # mobile (Telenet)
116
+ it_splits '32495123456', ['32', '495', '12', '34', '56'] # mobile (Orange)
95
117
  it_splits '3270123123', ['32', '70', '123', '123'] # Bus Service?
118
+ it_splits '3278123123', ['32', '78', '123', '123'] # National rate service
119
+ it_splits '3290123123', ['32', '901', '23', '123'] # National rate service
120
+ it_splits '3280080404', ['32', '800', '80', '404'] # Apple support
96
121
  end
97
122
 
98
123
  describe 'Belize' do
@@ -116,16 +141,36 @@ describe 'country descriptions' do
116
141
  it_splits '26781234567', %w(267 8 1234 567)
117
142
  end
118
143
 
144
+ describe 'Bosnia and Herzegovina' do
145
+ it_splits '38766666666', %w(387 66 666 666)
146
+ it_splits '38733123456', %w(387 33 123 456)
147
+ end
148
+
119
149
  describe 'Brazil' do
120
150
  it_splits '551112341234', ['55', '11', '1234', '1234']
121
151
  it_splits '5511981231234', ['55', '11', '98123', '1234'] # São Paulo's 9 digits mobile
122
152
  it_splits '552181231234', ['55', '21', '8123', '1234']
123
153
  it_splits '5521981231234', ['55', '21', '98123', '1234'] # Rio de Janeiro's 9 digits mobile
124
- it_splits '551931311234', ['55', '19', '3131', '1234'] # Rio de Janeiro's 9 digits mobile
125
- it_splits '5519991311234', ['55', '19', '99131', '1234'] # Rio de Janeiro's 9 digits mobile
154
+ it_splits '551931311234', ['55', '19', '3131', '1234']
155
+ it_splits '5531991311234', ['55', '31', '99131', '1234'] # Belo Horizonte's 9th digit
156
+ it_splits '5571991311234', ['55', '71', '99131', '1234'] # Salvador's 9th digit
157
+ it_splits '5579991311234', ['55', '79', '99131', '1234'] # Sergipe's 9th digit
158
+ it_splits '5547991311234', ['55', '47', '99131', '1234'] # Santa Catarina's 9th digit
159
+ it_splits '5541991311234', ['55', '41', '99131', '1234'] # Parana's 9th digit
126
160
 
127
- context "special states with 9 in mobile" do
128
- %w{ 11 12 13 14 15 16 17 18 19 21 22 24 27 28 81 82 83 84 85 86 87 88 89 91 92 93 94 95 96 97 98 99}.each do |state_code|
161
+ context 'mobile numbers' do
162
+ %w{
163
+ 11 12 13 14 15 16 17 18 19
164
+ 21 22 24 27 28
165
+ 31 32 33 34 35 37 38
166
+ 61 62 63 64 65 66 67 68 69
167
+ 71 73 74 75 77 79
168
+ 81 82 83 84 85 86 87 88 89
169
+ 91 92 93 94 95 96 97 98 99
170
+ 41 42 43 44 45 46
171
+ 47 48 49
172
+ 51 53 54 55
173
+ }.each do |state_code|
129
174
  it_splits "55#{state_code}993051123", ['55', state_code, '99305', '1123']
130
175
  end
131
176
  end
@@ -134,6 +179,7 @@ describe 'country descriptions' do
134
179
  it_splits '5508002221234', ['55', '0800', '222', '1234']
135
180
  it_splits '5530032221', ['55', '3003', '2221']
136
181
  it_splits '5540209999', ['55', '4020', '9999']
182
+ it_splits '5540038999', ['55', '4003', '8999']
137
183
  it_splits '5540048999', ['55', '4004', '8999']
138
184
  end
139
185
 
@@ -142,6 +188,26 @@ describe 'country descriptions' do
142
188
  it_splits '55199', ['55', '199', ""]
143
189
  end
144
190
  end
191
+ describe "Bulgaria" do
192
+ it_splits '35929284000', ['359', '2', '928', '4000'] # Sofia
193
+ it_splits '359878357523', ['359', '87', '8357', '523']
194
+ it_splits '3593012345', ['359', '30', '12345']
195
+ it_splits '35930123456', ['359', '30', '12', '3456']
196
+ it_splits '35943312345', ['359', '433', '12345']
197
+ it_splits '3596012345', ['359', '60', '12345']
198
+ it_splits '35969123456', ['359', '69', '123456']
199
+ it_splits '35970512345', ['359', '705', '12345']
200
+ it_splits '3597051234', ['359', '705', '1234']
201
+ it_splits '3597112345', ['359', '71', '12345']
202
+ it_splits '35979123456', ['359', '79', '123456']
203
+ it_splits '35980112345', ['359', '801', '12345']
204
+ it_splits '3598112345', ['359', '81', '12345']
205
+ it_splits '35986123456', ['359', '86', '123456']
206
+ it_splits '359881234567', ['359', '88', '1234', '567']
207
+ it_splits '35990123456', ['359', '90', '123456']
208
+ it_splits '359988123456', ['359', '988', '123456']
209
+ it_splits '359998123456', ['359', '998', '123456']
210
+ end
145
211
  describe 'Cambodia' do
146
212
  it_splits '85512236142', ["855", "12", "236", "142"] # mobile (Mobitel)
147
213
  it_splits '855977100872', ["855", "97", "710", "0872"] # mobile (Metfone)
@@ -157,15 +223,35 @@ describe 'country descriptions' do
157
223
  describe 'China' do
158
224
  it_splits '862112345678', ['86', '21', '1234', '5678'] # Shanghai
159
225
  it_splits '8675582193447', ['86', '755', '8219', '3447'] # Shenzhen
226
+ it_splits '869511234567', ['86', '951', '123', '4567'] # Yinchuan
227
+
228
+ context 'mobile numbers' do
229
+ %w{
230
+ 130 131 132 133 134 135 136 137 138 139
231
+ 145 146 147 148 149
232
+ 150 151 152 153 155 156 157 158 159
233
+ 162 165 166 167
234
+ 170 171 172 173 174 175 176 177 178
235
+ 180 181 182 183 184 185 186 187 188 189
236
+ 190 191 192 193 195 196 197 198 199
237
+ }.each do |prefix|
238
+ it_splits "86#{prefix}12345678", ['86', prefix, '1234', '5678']
239
+ end
240
+ end
160
241
  end
161
242
  describe 'Colombia' do
162
- it_splits '5711234567', ['57', '1', '123', '4567']
243
+ it_splits '5711234567', ['57', '1', '123', '4567'] # Outdated.
163
244
  it_splits '573101234567', ['57', '310', '123', '4567'] # mobile
164
245
  end
165
246
  describe 'Croatia' do
166
247
  it_splits '38521695900', %w( 385 21 695 900 ) # Landline
167
248
  it_splits '38514566666', %w( 385 1 4566 666 ) # Landline (Zagreb)
249
+ it_splits '38599444999', %w( 385 99 444 999 ) # Mobile
168
250
  it_splits '385918967509', %w( 385 91 896 7509 ) # Mobile
251
+ it_splits '3858001234', %w( 385 800 1234 ) # Toll free
252
+ it_splits '385800123456', %w( 385 800 123 456 ) # Toll free
253
+ it_splits '3856012345', %w( 385 60 12 345 ) # Premium rate
254
+ it_splits '38562123456', %w( 385 62 123 456 ) # Premium, personal and UAN
169
255
  end
170
256
  describe 'Cuba' do
171
257
  it_splits '5351231234', ['53', '5123', '1234'] # Mobile
@@ -203,7 +289,7 @@ describe 'country descriptions' do
203
289
  it_splits '3589123123', ['358', '9', '123', '123'] # Helsinki
204
290
  it_splits '3581912312', ['358', '19', '123', '12'] # Nylandia
205
291
  it_splits '3585012312', ['358', '50', '123', '12'] # Mobile
206
- it_splits '358600123', ['358', '600', '123'] # Service
292
+ it_splits '35860012345', ['358', '6001', '23', '45'] # Service
207
293
  end
208
294
  describe 'France' do
209
295
  it_splits '33112345678', ['33', '1', '12','34','56','78'] # Paris
@@ -229,7 +315,7 @@ describe 'country descriptions' do
229
315
  it_splits '49800222340010', ['49', '800', '222', '340010'] # Service number
230
316
 
231
317
  it_splits '4915111231234', ['49', '151', '1123', '1234'] # Mobile number
232
- it_splits '4915771231234', ['49', '157', '7123', '1234'] # Mobile number
318
+ it_splits '4915771231234', ['49', '1577', '123', '1234'] # Mobile number
233
319
  it_splits '491601234567', ['49', '160', '1234', '567'] # Mobile number
234
320
  it_splits '4916312345678', ['49', '163', '1234', '5678'] # Mobile number
235
321
  it_splits '4915211231234', ['49', '1521', '123', '1234'] # Mobile number
@@ -267,7 +353,8 @@ describe 'country descriptions' do
267
353
  end
268
354
 
269
355
  describe 'Hong Kong' do
270
- it_splits '85212341234', ['852', false, '1234', '1234'] #
356
+ it_splits '85212341234', ['852', false, '1234', '1234'] #Other Numbers
357
+ it_splits '852800121234', ['852', '800', '12', '1234'] #Toll Free
271
358
  end
272
359
 
273
360
  describe 'Hungary' do
@@ -296,6 +383,8 @@ describe 'country descriptions' do
296
383
  it_splits '622112345567', %w(62 21 1234 5567)
297
384
  it_splits '622212345', %w(62 22 123 45)
298
385
  it_splits '62221234567', %w(62 22 123 4567)
386
+ it_splits '622200000000', %w(62 22 0000 0000)
387
+ it_splits '6222000000000', %w(62 22 000 000 000)
299
388
  it_splits '624311234', %w(62 4 311 234)
300
389
  it_splits '62431123456', %w(62 4 3112 3456)
301
390
  it_splits '6262212345', %w(62 6 221 2345)
@@ -313,6 +402,8 @@ describe 'country descriptions' do
313
402
  it_splits '62877123456', %w(62 877 123 456)
314
403
  it_splits '62881123456', %w(62 881 123 456)
315
404
  it_splits '6288112345656', %w(62 881 1234 5656)
405
+ it_splits '62881123456567', %w(62 881 1234 56567)
406
+ it_splits '628990344805', %w(62 899 034 4805)
316
407
  it_splits '6291234567', %w(62 9 1234 567)
317
408
  it_splits '629123456789', %w(62 9 123 456 789)
318
409
  end
@@ -334,6 +425,7 @@ describe 'country descriptions' do
334
425
  it_splits '35311234567', ['353', '1', '123', '4567'] # Dublin, 7 digit subscriber #
335
426
  it_splits '353539233333', ['353', '53', '923', '3333'] # Wexford, 7 digit subscriber
336
427
  it_splits '3532212345', ['353', '22', '12345'] # Mallow, 5 digit subscriber #
428
+ it_splits '353441234567', ['353', '44', '123', '4567'] # Mullingar, Castlepollard, Tyrellspass 7 digit subscriber #
337
429
  it_splits '35345123456', ['353', '45', '123456'] # Naas, 6 digit subscriber #
338
430
  it_splits '353801234567', ['353', '80', '123', '4567'] # Mobile
339
431
  it_splits '353761234567', ['353', '76', '123', '4567'] # VoIP
@@ -342,14 +434,16 @@ describe 'country descriptions' do
342
434
  end
343
435
 
344
436
  describe 'Israel (972)' do
345
- it_splits '972100', ['972', '1', '00'] # Police
346
- it_splits '97221231234', ['972', '2', '123', '1234'] # Jerusalem Area
347
- it_splits '97282411234', ['972', '8', '241', '1234'] # Gaza Strip (Palestine)
348
- it_splits '97291231234', ['972', '9', '123', '1234'] # Sharon Area
349
- it_splits '972501231234', ['972', '50', '123', '1234'] # Mobile (Pelephone)
350
- it_splits '972591231234', ['972', '59', '123', '1234'] # Mobile Jawwal (Palestine)
351
- it_splits '972771231234', ['972', '77', '123', '1234'] # Cable Phone Services
437
+ it_splits '972100', ['972', '1', '00'] # Police
438
+ it_splits '97221231234', ['972', '2', '123', '1234'] # Jerusalem Area
439
+ it_splits '97282411234', ['972', '8', '241', '1234'] # Gaza Strip (Palestine)
440
+ it_splits '97291231234', ['972', '9', '123', '1234'] # Sharon Area
441
+ it_splits '972501231234', ['972', '50', '123', '1234'] # Mobile (Pelephone)
442
+ it_splits '972591231234', ['972', '59', '123', '1234'] # Mobile Jawwal (Palestine)
443
+ it_splits '972771231234', ['972', '77', '123', '1234'] # Cable Phone Services
352
444
  it_splits '9721700123123', ['972', '1', '700', '123', '123'] # Cable Phone Services
445
+ it_splits '972511234567', ['972', '51', '123', '4567'] # Mobile (We4G)
446
+ it_splits '972791111111', ['972', '79', '111', '1111'] # Landline (Hallo, Cellact, Telzar)
353
447
  end
354
448
  describe 'Israel (970)' do
355
449
  it_splits '97021231234', ['970', '2', '123', '1234'] # Jerusalem Area
@@ -366,16 +460,23 @@ describe 'country descriptions' do
366
460
  it_splits '3934869528123',['39', '348', '695', '2812', '3'] # Mobile (8-digit subscriber no - new)
367
461
  it_splits '393357210488', ['39', '335', '721', '0488'] # Mobile
368
462
  it_splits '393248644272', ['39', '324', '864', '4272'] # Mobile
369
- it_splits '390612341234', ['39', '06', '1234', '1234'] # Roma
370
- it_splits '390288838883', ['39', '02', '8883', '8883'] # Milano
463
+ it_splits '390612341', ['39', '06', '12341'] # Roma 5 digit
464
+ it_splits '3906123412', ['39', '06', '1234', '12'] # Roma 6 digit
465
+ it_splits '39061234123', ['39', '06', '1234', '123'] # Roma 7 digit
466
+ it_splits '390612341234', ['39', '06', '1234', '1234'] # Roma 8 digit
467
+ it_splits '3902888388', ['39', '02', '8883', '88'] # Milano 6 digit
468
+ it_splits '39028883888', ['39', '02', '8883', '888'] # Milano 7 digit
469
+ it_splits '390288838883', ['39', '02', '8883', '8883'] # Milano 8 digit
371
470
  it_splits '390141595661', ['39', '0141', '595', '661'] # Asti
372
471
  it_splits '3903123391', ['39', '031', '23391'] # Como
373
472
  it_splits '390909709511', ['39', '090', '9709511'] # Barcellona
374
473
  it_splits '390471811353', ['39', '0471', '811', '353'] # Bolzano
474
+ it_splits '3905745730', ['39', '0574', '5730'] # Prato
375
475
  end
376
476
  describe 'Japan' do
377
477
  it_splits '81312345678', %w(81 3 1234 5678) # Tokyo
378
478
  it_splits '81612345678', %w(81 6 1234 5678) # Osaka
479
+ it_splits '818001001234', %w(81 800 100 1234) # Freephone
379
480
  it_splits '81120123456', %w(81 120 123 456) # Freephone
380
481
  it_splits '81111234567', %w(81 11 123 4567)
381
482
  it_splits '81123123456', %w(81 123 12 3456)
@@ -386,12 +487,18 @@ describe 'country descriptions' do
386
487
  it_splits '817012345678', %w(81 70 1234 5678) # PHS
387
488
  it_splits '818012345678', %w(81 80 1234 5678) # Cellular
388
489
  it_splits '819012345678', %w(81 90 1234 5678) # Cellular
490
+ it_splits '810570123456', %w(81 570 123 456) # Navi-dial
491
+ it_splits '810180123456', %w(81 180 123 456) # Tele-gong/Tele-dome
389
492
  end
390
493
  describe 'Kenya' do
391
494
  it_splits '254201234567', ['254', '20', '1234567'] # Nairobi
392
495
  it_splits '254111234567', ['254', '11', '1234567'] # Mombasa
393
496
  it_splits '254723100220', ['254', '723', '100220'] # Mombasa
394
497
  end
498
+ describe 'Kosovo' do
499
+ it_splits '38329000000', ['383', '29', '000', '000'] # Landline
500
+ it_splits '38344000000', ['383', '44', '000', '000'] # Mobile
501
+ end
395
502
  describe 'Kyrgyzstan' do
396
503
  it_splits '996312212345', %w(996 312 212 345)
397
504
  it_splits '996315212345', %w(996 315 212 345)
@@ -411,12 +518,28 @@ describe 'country descriptions' do
411
518
  end
412
519
  describe 'Luxembourg' do
413
520
  it_splits '352222809', ['352', '22', '28', '09']
414
- it_splits '35226222809', ['352', '26', '22', '28', '09']
521
+ it_splits '35226222809', ['352', '2622', '28', '09']
415
522
  it_splits '352621123456', ['352', '621', '123', '456']
416
- it_splits '3524123456', ['352', '4', '12', '34', '56']
523
+ it_splits '3524123456', ['352', '41', '23', '45', '6']
417
524
  it_splits '352602112345678', ['352', '6021', '12', '34', '56', '78']
418
525
  it_splits '352370431', ['352', '37', '04', '31']
419
526
  it_splits '35227855', ['352', '27', '85', '5']
527
+ it_splits '352445566', ['352', '44', '55', '66']
528
+ it_splits '352545258', ['352', '54', '52', '58']
529
+ it_splits '352818181', ['352', '81', '81', '81']
530
+ it_splits '3523572141', ['352', '35', '72', '14', '1']
531
+ end
532
+ describe 'Macedonia' do
533
+ it_splits '38921234567', ['389', '2', '123', '4567'] # Skopje
534
+ it_splits '38931234567', ['389', '3', '123', '4567'] # Eastern Macedonia
535
+ it_splits '38941234567', ['389', '4', '123', '4567'] # Western Macedonia
536
+ it_splits '38951234567', ['389', '5', '123', '4567'] # Premium
537
+ it_splits '38971234567', ['389', '7', '123', '4567'] # Mobile
538
+ end
539
+ describe 'Macao' do
540
+ it_splits '85328123456', ["853", "28", "12", "3456"] # Landline
541
+ it_splits '85381234567', ["853", "8", "123", "4567"] # Landline
542
+ it_splits '85361234567', ["853", "6", "123", "4567"] # Mobile
420
543
  end
421
544
  describe 'Malaysia' do
422
545
  it_splits '6082123456', ['60', '82', '123456'] # Kuching
@@ -468,6 +591,7 @@ describe 'country descriptions' do
468
591
  it_splits '31612345678', ['31', '6', '12', '34', '56', '78'] # mobile
469
592
  it_splits '31201234567', ['31', '20', '123', '4567']
470
593
  it_splits '31222123456', ['31', '222', '123', '456']
594
+ it_splits '3197012345678', ['31', '970', '1234', '5678'] # machine-to-machine
471
595
  end
472
596
  describe 'Norway' do
473
597
  it_splits '4721234567', ['47',false,'21','23','45','67']
@@ -496,12 +620,13 @@ describe 'country descriptions' do
496
620
  it_splits '595961611234', %w(595 96 161 1234)
497
621
  end
498
622
  describe 'Peru' do
499
- it_splits '51112341234', ['51', '1', '1234', '1234'] # Lima
623
+ it_splits '5111231234', ['51', '1', '123', '1234'] # Lima
500
624
  it_splits '51912341234', ['51', '9', '1234', '1234'] # mobile
501
- it_splits '51841234123', ['51', '84', '1234', '123'] # Cuzco, best effort
625
+ it_splits '5184123123', ['51', '84', '123', '123'] # Cuzco, best effort
502
626
  end
503
627
  describe 'Philippines' do
504
628
  it_splits '6321234567', ['63', '2', '1234567']
629
+ it_splits '63289889999', ['63', '2', '89889999']
505
630
  it_splits '6321234567890', ['63', '2', '1234567890']
506
631
  it_splits '632123456789012', ['63', '2', '123456789012']
507
632
  it_splits '639121234567', ['63', '912', '1234567']
@@ -510,6 +635,8 @@ describe 'country descriptions' do
510
635
  describe 'Poland' do
511
636
  it_splits '48123456789', ['48', '12', '345', '67', '89'] # Landline
512
637
  it_splits '48501123456', ['48', '501', '123', '456'] # Mobile
638
+ it_splits '48571123456', ['48', '571', '123', '456'] # Mobile
639
+ it_splits '48451123456', ['48', '451', '123', '456'] # Mobile
513
640
  it_splits '48800123456', ['48', '800', '123', '456'] # Free
514
641
  it_splits '48801123456', ['48', '801', '123', '456'] # Shared cost
515
642
  it_splits '48701123456', ['48', '701', '123', '456'] # Premium
@@ -535,20 +662,27 @@ describe 'country descriptions' do
535
662
  it_splits '40791231234', ['40', '79', '123', '1234'] # mobile
536
663
  it_splits '40249123123', ['40', '249', '123', '123'] # Olt
537
664
  end
665
+
538
666
  describe 'Russia' do
539
667
  it_splits '78122345678', ['7', '812', '234', '56', '78'] # Russia 3-digit
540
668
  it_splits '74012771077', ['7', '4012', '77', '10', '77'] # Russia 4-digit
541
669
  it_splits '78402411212', ['7', '84024', '1', '12', '12'] # Russia 5-digit
542
- it_splits '79296119119', ['7', '929', '611', '91', '19'] # Russia 3-digit, Megafon Mobile.
670
+ it_splits '79296119119', ['7', '929', '611', '91', '19'] # Russia 3-digit, Megafon Mobile
671
+ it_splits '79691234567', ['7', '969', '123', '45', '67'] # Russia 3-digit, Beeline
672
+ it_splits '79771234567', ['7', '977', '123', '45', '67'] # Russia 3-digit
673
+ it_splits '79961234567', ['7', '996', '123', '45', '67'] # Russia 3-digit
674
+ it_splits '79991234567', ['7', '999', '123', '45', '67'] # Russia 3-digit
543
675
  it_splits '7840121212', ['7', '840', '12', '1212'] # Abhasia
544
676
  it_splits '7799121212', ['7', '799', '12', '1212'] # Kazachstan
545
- it_splits '7995344121212', ['7','995344','12','1212'] # South Osetia
677
+ it_splits '7995344121212', ['7', '995', '344','12','1212'] # South Osetia
546
678
  it_splits '7209175276', ['7', '209', '17', '5276'] # Fantasy number
547
679
  end
548
- describe 'Rwanda' do
680
+
681
+ describe 'Rwanda' do
549
682
  it_splits '250781234567', ['250', '78', '1234567'] # mobile
550
683
  it_splits '250721234567', ['250', '72', '1234567'] # mobile
551
684
  it_splits '250731234567', ['250', '73', '1234567'] # mobile
685
+ it_splits '250791234567', ['250', '79', '1234567'] # mobile
552
686
  it_splits '250251234567', ['250', '25', '1234567'] # fixed
553
687
  it_splits '25006123456', ['250', '06', '123456'] # fixed
554
688
  end
@@ -557,8 +691,10 @@ describe 'country descriptions' do
557
691
  it_splits '2399920012', %w(239 9 920 012)
558
692
  end
559
693
  describe 'South Korea' do
560
- it_splits '82212345678', ['82', '2', '1234', '5678'] # Seoul
561
- it_splits '825112345678', ['82', '51', '1234', '5678'] # Busan
694
+ it_splits '82212345678', ['82', '2', '1234', '5678'] # Seoul (8 digits)
695
+ it_splits '8227111222', ['82', '2', '711', '1222'] # Seoul (7 digits)
696
+ it_splits '825112345678', ['82', '51', '1234', '5678'] # Busan (8 digits)
697
+ it_splits '82511234567', ['82', '51', '123', '4567'] # Busan (7 digits)
562
698
  it_splits '821027975588', ['82', '10', '2797', '5588'] # mobile
563
699
  it_splits '821087971234', ['82', '10', '8797', '1234'] # mobile
564
700
  end
@@ -588,12 +724,15 @@ describe 'country descriptions' do
588
724
  end
589
725
 
590
726
  describe 'Singapore' do
591
- it_splits '6561231234', ['65', false, '6123', '1234'] # Fixed line
727
+ it_splits '6561231234', ['65', false, '6123', '1234'] # Fixed line
728
+ it_splits '658008521234', ['65', false, '800', '852', '1234'] # International Toll Free Service (ITFS) and Home Country Direct Service (HCDS) Numbers
592
729
  end
593
730
  describe 'Slovakia' do
594
731
  it_splits '421912123456', ['421', '912', '123456'] # Mobile
595
732
  it_splits '421212345678', ['421', '2', '12345678'] # Bratislava
733
+ it_splits '4212123', ['421', '2', '123'] # Bratislava Short
596
734
  it_splits '421371234567', ['421', '37', '1234567'] # Nitra / Other
735
+ it_splits '42137123', ['421', '37', '123'] # Nitra / Other Short
597
736
  end
598
737
 
599
738
  describe 'Slovenia' do
@@ -617,11 +756,19 @@ describe 'country descriptions' do
617
756
  it_splits '46812345678', ['46', '8', '123', '45', '678'] # Stockholm
618
757
  it_splits '46111234567', ['46', '11', '123', '45', '67']
619
758
  it_splits '46721234567', ['46', '72', '123', '45', '67'] # mobile
620
- it_splits '46125123456', ['46', '125', '123', '456']
759
+ it_splits '46791234567', ['46', '79', '123', '45', '67'] # mobile
760
+ it_splits '46125123456', ['46', '125', '12', '34', '56']
761
+ it_splits '46770820180', ['46', '77', '082', '01', '80']
762
+ it_splits '4641712345', ['46', '417', '123', '45']
763
+ it_splits '46513123456', ['46', '513', '12', '34', '56']
621
764
  end
622
765
  describe 'Switzerland' do
623
766
  it_splits '41443643532', ['41', '44', '364', '35', '32'] # Zurich (usually)
624
767
  it_splits '41800334455', ['41', '800', '334', '455'] # Service number
768
+ it_splits '41860443643532', ['41', '860', '44', '364', '35', '32'] # Voicemail access
769
+ it_splits '41900123456', ['41', '900', '123', '456'] # Business Number
770
+ it_splits '41901123456', ['41', '901', '123', '456'] # Business Number Entertainment
771
+ it_splits '41906123456', ['41', '906', '123', '456'] # Business Number Adult Entertainment
625
772
  end
626
773
  describe 'Tanzania' do
627
774
  it_splits '255221231234', ['255', '22', '123', '1234'] # Dar Es Salaam
@@ -699,15 +846,23 @@ describe 'country descriptions' do
699
846
  end
700
847
  describe 'Vietnam' do
701
848
  it_splits '8498123456', ['84', '98', '123456'] # Viettel Mobile
702
- it_splits '8499612345', ['84', '996', '12345'] # GTel
703
- it_splits '84412345678', ['84', '4', '1234', '5678'] # Hanoi
849
+ it_splits '8499612345', ['84', '99', '612345'] # GTel
850
+ it_splits '842421234567', ['84', '24', '2123', '4567'] # Hanoi
851
+ it_splits '842841234567', ['84', '28', '4123', '4567'] # Ho Chi Minh City
852
+ it_splits '84341234567', ['84', '34', '1234567'] # Viettel
853
+ it_splits '84841234567', ['84', '84', '1234567'] # Vinaphone
704
854
  end
705
855
  describe 'Zambia' do
706
- it_splits '260955123456', ['260', '955', '123456'] # mobile
707
- it_splits '260211123456', ['260', '211', '123456'] # fixed
856
+ it_splits '260211123456', ['260', '211', '123456'] # Fixed
857
+ it_splits '260955123456', ['260', '95', '512', '3456'] # Mobile
858
+ it_splits '260967123456', ['260', '96', '712', '3456'] # Mobile
859
+ it_splits '260978123456', ['260', '97', '812', '3456'] # Mobile
860
+ it_splits '260800123456', ['260', '800', '123', '456'] # Toll free
708
861
  end
709
862
  describe 'New Zealand' do
710
863
  it_splits '6491234567', ['64', '9', '123', '4567']
864
+ it_splits '64800123123', ['64', '800', '123', '123']
865
+ it_splits '648001231234', ['64', '800', '123', '1234']
711
866
  end
712
867
  describe 'Bhutan (Kingdom of)' do
713
868
  it_splits '9759723642', %w(975 9 723 642)
@@ -722,7 +877,7 @@ describe 'country descriptions' do
722
877
  it_splits '25712345678', ['257', false, '1234', '5678']
723
878
  end
724
879
  describe 'Cameroon' do
725
- it_splits '23727659381', ['237', false, '2765', '9381']
880
+ it_splits '237276593812', ['237', false, '276', '59', '38', '12']
726
881
  end
727
882
  describe 'Cape Verde' do
728
883
  it_splits '2385494177', ['238', false, '549', '4177']
@@ -747,14 +902,14 @@ describe 'country descriptions' do
747
902
  it_splits '50622345678', %w(506 2 234 5678)
748
903
  end
749
904
  describe "Côte d'Ivoire" do
750
- it_splits '22507335518', ['225', '07', '33', '55', '18']
751
- it_splits '22537335518', ['225', '37', '33', '55', '18']
905
+ it_splits '2250107335518', ['225', '01', '07', '33', '55', '18']
906
+ it_splits '2250237335518', ['225', '02', '37', '33', '55', '18']
752
907
  end
753
908
  describe 'Democratic Republic of Timor-Leste' do
754
909
  it_splits '6701742945', ['670', false, '174', '2945']
755
910
  end
756
911
  describe 'Democratic Republic of the Congo' do
757
- it_splits '24311995381', %w(243 1 199 5381)
912
+ it_splits '243121995381', %w(243 12 199 5381)
758
913
  end
759
914
  describe 'Diego Garcia' do
760
915
  it_splits '2461234683', ['246', false, '123', '4683']
@@ -763,7 +918,30 @@ describe 'country descriptions' do
763
918
  it_splits '25349828978', ['253', false, '4982', '8978']
764
919
  end
765
920
  describe 'Ecuador' do
766
- it_splits '593445876756', %w(593 44 587 6756)
921
+ it_splits '593220000000', %w(593 22 000 0000)
922
+ it_splits '59322000000', %w(593 2 200 0000)
923
+ it_splits '593230000000', %w(593 23 000 0000)
924
+ it_splits '59323000000', %w(593 2 300 0000)
925
+ it_splits '59324000000', %w(593 2 400 0000)
926
+ it_splits '59325000000', %w(593 2 500 0000)
927
+ it_splits '593260000000', %w(593 26 000 0000)
928
+ it_splits '59327000000', %w(593 2 700 0000)
929
+ it_splits '593270000000', %w(593 27 000 0000)
930
+ it_splits '59330000000', %w(593 3 000 0000)
931
+ it_splits '59340000000', %w(593 4 000 0000)
932
+ it_splits '593440000000', %w(593 44 000 0000)
933
+ it_splits '593450000000', %w(593 45 000 0000)
934
+ it_splits '59345000000', %w(593 4 500 0000)
935
+ it_splits '59346000000', %w(593 4 600 0000)
936
+ it_splits '593470000000', %w(593 47 000 0000)
937
+ it_splits '59352000000', %w(593 5 200 0000)
938
+ it_splits '59353000000', %w(593 5 300 0000)
939
+ it_splits '59362000000', %w(593 6 200 0000)
940
+ it_splits '59372000000', %w(593 7 200 0000)
941
+ it_splits '59373000000', %w(593 7 300 0000)
942
+ it_splits '59374000000', %w(593 7 400 0000)
943
+ it_splits '59376000000', %w(593 7 600 0000)
944
+ it_splits '593900000000', %w(593 9 0000 0000)
767
945
  end
768
946
  describe 'Eritrea' do
769
947
  it_splits '2916537192', %w(291 6 537 192)
@@ -788,6 +966,7 @@ describe 'country descriptions' do
788
966
  end
789
967
  describe 'Gabonese Republic' do
790
968
  it_splits '2411834375', ['241', '1', '834', '375']
969
+ it_splits '24174012345', ['241', '74', '01', '23', '45']
791
970
  end
792
971
  describe 'Gambia' do
793
972
  it_splits '2206683355', ['220', false, '668', '3355']
@@ -808,7 +987,7 @@ describe 'country descriptions' do
808
987
  it_splits '224662123456', ['224', '662', '12', '34', '56']
809
988
  end
810
989
  describe 'Guinea-Bissau' do
811
- it_splits '2453837652', ['245', false, '383', '7652']
990
+ it_splits '245443837652', ['245', false, '44', '383', '7652']
812
991
  end
813
992
  describe 'Guyana' do
814
993
  it_splits '5922631234', %w(592 263 1234)
@@ -875,11 +1054,14 @@ describe 'country descriptions' do
875
1054
  it_splits '21822123456', %w(218 22 123 456)
876
1055
  it_splits '218211234456', %w(218 21 1234 456)
877
1056
  it_splits '218911234456', %w(218 91 1234 456)
1057
+ it_splits '218941234456', %w(218 94 1234 456)
1058
+ it_splits '218951234456', %w(218 95 1234 456)
878
1059
  end
879
1060
  describe 'Madagascar' do
880
- it_splits '26120012345678', ['261', false, '20', '012', '345', '678']
881
- it_splits '261201243456', ['261', false, *%w(20 124 3456)]
882
- it_splits '261512345678', ['261', false, *%w(512 345 678)]
1061
+ it_splits '261202254716', ['261', '20', *%w(22 547 16)]
1062
+ it_splits '261320254716', ['261', '32', *%w(02 547 16)]
1063
+ it_splits '261330254716', ['261', '33', *%w(02 547 16)]
1064
+ it_splits '261340254716', ['261', '34', *%w(02 547 16)]
883
1065
  end
884
1066
  describe 'Malawi' do
885
1067
  it_splits '2651725123', ['265', false, '1725', '123']
@@ -903,7 +1085,7 @@ describe 'country descriptions' do
903
1085
  it_splits '22212345678', ['222', false, '1234', '5678']
904
1086
  end
905
1087
  describe 'Mauritius' do
906
- it_splits '2309518919', ['230', false, '951', '8919']
1088
+ it_splits '23059518919', ['230', false, '5951', '8919']
907
1089
  end
908
1090
  describe 'Micronesia (Federated States of)' do
909
1091
  it_splits '6911991754', ['691', false, '199', '1754']
@@ -956,6 +1138,8 @@ describe 'country descriptions' do
956
1138
  describe 'Nigeria' do
957
1139
  it_splits '23411231234', %w(234 1 123 1234) # Lagos
958
1140
 
1141
+ it_splits '23445123456', %w(234 45 123 456) # Ogoja
1142
+
959
1143
  # mobile numbers
960
1144
  it_splits '2347007661234', %w(234 700 766 1234)
961
1145
  it_splits '2347017661234', %w(234 701 766 1234)
@@ -990,6 +1174,17 @@ describe 'country descriptions' do
990
1174
  it_splits '2349087661234', %w(234 908 766 1234)
991
1175
  it_splits '2349097661234', %w(234 909 766 1234)
992
1176
 
1177
+ it_splits '2349107661234', %w(234 910 766 1234)
1178
+ it_splits '2349117661234', %w(234 911 766 1234)
1179
+ it_splits '2349127661234', %w(234 912 766 1234)
1180
+ it_splits '2349137661234', %w(234 913 766 1234)
1181
+ it_splits '2349147661234', %w(234 914 766 1234)
1182
+ it_splits '2349157661234', %w(234 915 766 1234)
1183
+ it_splits '2349167661234', %w(234 916 766 1234)
1184
+ it_splits '2349177661234', %w(234 917 766 1234)
1185
+ it_splits '2349187661234', %w(234 918 766 1234)
1186
+ it_splits '2349197661234', %w(234 919 766 1234)
1187
+
993
1188
  it_splits '2348107661234', %w(234 810 766 1234)
994
1189
  it_splits '2348117661234', %w(234 811 766 1234)
995
1190
  it_splits '2348127661234', %w(234 812 766 1234)
@@ -1025,6 +1220,9 @@ describe 'country descriptions' do
1025
1220
  it_splits '6752751234', %w(675 275 1234)
1026
1221
  it_splits '67527912', %w(675 279 12)
1027
1222
  it_splits '67511512345678', %w(675 115 1234 5678)
1223
+ it_splits '67574123456', %w(675 74 123 456)
1224
+ it_splits '67573123456', %w(675 731 23 456)
1225
+ it_splits '67577301234', %w(675 7730 1 234)
1028
1226
  end
1029
1227
  describe 'Reunion / Mayotte (new)' do
1030
1228
  it_splits '262594399265', ['262', '594', '39', '92', '65']
@@ -1038,6 +1236,7 @@ describe 'country descriptions' do
1038
1236
  describe 'Samoa (Independent State of)' do
1039
1237
  it_splits '685800123', ['685', false, '800', '123']
1040
1238
  it_splits '68561123', ['685', false, '61', '123']
1239
+ it_splits '6857112345', ['685', false, '711', '2345']
1041
1240
  it_splits '6857212345', ['685', false, '721', '2345']
1042
1241
  it_splits '685830123', ['685', false, '830', '123']
1043
1242
  it_splits '685601234', ['685', false, '601', '234']
@@ -1052,8 +1251,11 @@ describe 'country descriptions' do
1052
1251
  it_splits '3785123456789', ['378', false, '512', '345', '6789']
1053
1252
  end
1054
1253
  describe 'Saudi Arabia (Kingdom of)' do
1055
- it_splits '9660208528423', %w(966 020 852 8423)
1056
- it_splits '966506306201', %w(966 50 630 6201)
1254
+ it_splits '9660208528423', %w(966 020 852 8423) # Fixed
1255
+ it_splits '966506306201', %w(966 50 630 6201) # NDC Mobile
1256
+ it_splits '966112345678', %w(966 11 234 5678) # NDC Region
1257
+ it_splits '9668001234567', %w(966 800 123 4567) # Toll Free
1258
+ it_splits '966920012345', %w(966 9200 12345) # Univeral Access
1057
1259
  end
1058
1260
  describe 'Senegal' do
1059
1261
  it_splits '221123456789', ['221', false, '1234', '56789']
@@ -1072,6 +1274,7 @@ describe 'country descriptions' do
1072
1274
  it_splits '38160123', %w(381 60 123)
1073
1275
  it_splits '381601234567890', %w(381 60 123 456 7890)
1074
1276
  it_splits '38170123456', %w(381 70 123 456)
1277
+ it_splits '38163123456', %w(381 63 123 456)
1075
1278
  end
1076
1279
  describe 'Sierra Leone' do
1077
1280
  it_splits '23264629769', %w(232 64 629 769)
@@ -1080,13 +1283,23 @@ describe 'country descriptions' do
1080
1283
  it_splits '67754692', ['677', false, '54', '692']
1081
1284
  it_splits '6777546921', ['677', false, '7546', '921']
1082
1285
  end
1083
- describe 'Somali Democratic Republic' do
1286
+ describe 'Somalia' do
1084
1287
  it_splits '252103412345', %w(252 1034 123 45)
1085
1288
  it_splits '2521313123', %w(252 1313 123)
1086
1289
  it_splits '2521601234', %w(252 160 12 34)
1087
1290
  it_splits '25250012345', %w(252 500 123 45)
1088
- it_splits '252671234567', %w(252 67 1234 567)
1291
+ it_splits '252612345678', %w(252 61 234 5678) # Hormuud
1292
+ it_splits '252622345678', %w(252 62 234 5678) # Somtel Mogadishu
1293
+ it_splits '252634000613', %w(252 63 400 0613) # Telesom
1294
+ it_splits '252642345678', %w(252 64 234 5678) # Hormuud
1295
+ it_splits '252652345678', %w(252 65 234 5678) # Somtel
1296
+ it_splits '252662345678', %w(252 66 234 5678) # Somtel Puntland
1297
+ it_splits '252672345678', %w(252 67 234 5678) # Nationlink Mogadishu
1298
+ it_splits '252682345678', %w(252 68 234 5678) # Nationlink Mogadishu
1299
+ it_splits '252692345678', %w(252 69 234 5678) # Nationlink
1300
+ it_splits '252902345678', %w(252 90 234 5678) # Golis
1089
1301
  end
1302
+
1090
1303
  describe 'Suriname (Republic of)' do
1091
1304
  it_splits '597958434', ['597', false, '958', '434']
1092
1305
 
@@ -1104,16 +1317,22 @@ describe 'country descriptions' do
1104
1317
  it_splits '963912345678', %w(963 9 1234 5678)
1105
1318
  end
1106
1319
  describe 'Taiwan' do
1107
- it_splits '88618123456', %w(886 18 123 456)
1108
- it_splits '8866121234567', %w(886 612 123 4567)
1109
1320
  it_splits '886212345678', %w(886 2 1234 5678)
1110
1321
  it_splits '88631234567', %w(886 3 123 4567)
1111
- it_splits '88633123456', %w(886 33 123 456)
1112
- it_splits '88682712345', %w(886 827 123 45)
1113
- it_splits '8864121234', %w(886 412 1234)
1114
- it_splits '88690123456', %w(886 90 123 456)
1115
- it_splits '886901234567', %w(886 90 123 4567)
1116
- it_splits '88694991345', %w(886 94 991 345)
1322
+ it_splits '88651234567', %w(886 5 123 4567)
1323
+ it_splits '88661234567', %w(886 6 123 4567)
1324
+ it_splits '88671234567', %w(886 7 123 4567)
1325
+ it_splits '88633123456', %w(886 3 312 3456)
1326
+ it_splits '88637123456', %w(886 37 12 3456)
1327
+ it_splits '88682712345', %w(886 82 71 2345)
1328
+ it_splits '886801123123', %w(886 801 123 123)
1329
+ it_splits '88689712345', %w(886 89 71 2345)
1330
+ it_splits '88682672345', %w(886 826 7 2345)
1331
+ it_splits '88683672345', %w(886 836 7 2345)
1332
+ it_splits '88641212345', %w(886 4 121 2345)
1333
+ it_splits '886412123456', %w(886 4 1212 3456)
1334
+ it_splits '886491234567', %w(886 49 123 4567)
1335
+ it_splits '886901234567', %w(886 901 234 567)
1117
1336
  end
1118
1337
  describe 'Togolese Republic' do
1119
1338
  it_splits '22812345678', ['228', false, '1234', '5678']
@@ -1159,6 +1378,7 @@ describe 'country descriptions' do
1159
1378
  it_splits '380911234567', %w(380 91 123 45 67)
1160
1379
  it_splits '380921234567', %w(380 92 123 45 67)
1161
1380
  it_splits '380931234567', %w(380 93 123 45 67)
1381
+ it_splits '380731234567', %w(380 73 123 45 67)
1162
1382
  it_splits '380941234567', %w(380 94 123 45 67)
1163
1383
  it_splits '380951234567', %w(380 95 123 45 67)
1164
1384
  it_splits '380961234567', %w(380 96 123 45 67)
@@ -1169,11 +1389,15 @@ describe 'country descriptions' do
1169
1389
  describe 'United Arab Emirates' do
1170
1390
  it_splits '97180012', %w(971 800 12)
1171
1391
  it_splits '971800123456789', %w(971 800 12 345 6789)
1392
+ it_splits '97180012345678', %w(971 800 12 345 678)
1393
+ it_splits '9718001234567', %w(971 800 12 345 67)
1172
1394
  it_splits '97121234567', %w(971 2 123 4567)
1173
1395
  it_splits '971506412345', %w(971 50 641 2345)
1174
1396
  it_splits '971600641234', %w(971 600 641 234)
1175
1397
  it_splits '971500641234', %w(971 500 641 234)
1176
1398
  it_splits '971200641234', %w(971 200 641 234)
1399
+ it_splits '971549999999', %w(971 54 999 9999)
1400
+ it_splits '971589999999', %w(971 58 999 9999)
1177
1401
  end
1178
1402
  describe 'Uruguay (Eastern Republic of)' do
1179
1403
  it_splits '59880012345', %w(598 800 123 45)
@@ -1212,6 +1436,14 @@ describe 'country descriptions' do
1212
1436
  it_splits number, ['263', prefix, '234', '5678']
1213
1437
  end
1214
1438
  end
1439
+
1440
+ describe 'Universal International Freephone' do
1441
+ it_splits '80012345678', ['800', false, '12345678']
1442
+ end
1443
+
1444
+ describe 'Shared-Cost Service' do
1445
+ it_splits '80812345678', ['808', false, '12345678']
1446
+ end
1215
1447
  end
1216
1448
 
1217
1449
  end