phony 2.20.13 → 2.20.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/lib/phony/config.rb +25 -26
  3. data/lib/phony/countries/argentina.rb +311 -314
  4. data/lib/phony/countries/austria.rb +71 -72
  5. data/lib/phony/countries/bangladesh.rb +27 -28
  6. data/lib/phony/countries/belarus.rb +110 -111
  7. data/lib/phony/countries/brazil.rb +92 -92
  8. data/lib/phony/countries/cambodia.rb +9 -9
  9. data/lib/phony/countries/china.rb +22 -21
  10. data/lib/phony/countries/croatia.rb +6 -5
  11. data/lib/phony/countries/georgia.rb +84 -84
  12. data/lib/phony/countries/germany.rb +4067 -4068
  13. data/lib/phony/countries/guinea.rb +8 -8
  14. data/lib/phony/countries/india.rb +31 -34
  15. data/lib/phony/countries/indonesia.rb +57 -46
  16. data/lib/phony/countries/ireland.rb +4 -5
  17. data/lib/phony/countries/italy.rb +54 -53
  18. data/lib/phony/countries/japan.rb +456 -456
  19. data/lib/phony/countries/kyrgyzstan.rb +109 -109
  20. data/lib/phony/countries/latvia.rb +34 -34
  21. data/lib/phony/countries/libya.rb +106 -106
  22. data/lib/phony/countries/malaysia.rb +12 -12
  23. data/lib/phony/countries/moldova.rb +42 -42
  24. data/lib/phony/countries/montenegro.rb +24 -20
  25. data/lib/phony/countries/myanmar.rb +39 -39
  26. data/lib/phony/countries/namibia.rb +35 -29
  27. data/lib/phony/countries/nepal.rb +60 -62
  28. data/lib/phony/countries/netherlands.rb +13 -13
  29. data/lib/phony/countries/pakistan.rb +135 -111
  30. data/lib/phony/countries/paraguay.rb +135 -135
  31. data/lib/phony/countries/russia_kazakhstan_abkhasia_south_ossetia.rb +125 -128
  32. data/lib/phony/countries/saudi_arabia.rb +5 -5
  33. data/lib/phony/countries/serbia.rb +47 -39
  34. data/lib/phony/countries/somalia.rb +18 -18
  35. data/lib/phony/countries/south_korea.rb +16 -13
  36. data/lib/phony/countries/sweden.rb +28 -28
  37. data/lib/phony/countries/taiwan.rb +20 -19
  38. data/lib/phony/countries/tajikistan.rb +70 -70
  39. data/lib/phony/countries/turkmenistan.rb +65 -65
  40. data/lib/phony/countries/ukraine.rb +607 -607
  41. data/lib/phony/countries/united_kingdom.rb +66 -66
  42. data/lib/phony/countries/uruguay.rb +40 -41
  43. data/lib/phony/countries/vietnam.rb +18 -17
  44. data/lib/phony/countries/zimbabwe.rb +31 -31
  45. data/lib/phony/countries.rb +440 -443
  46. data/lib/phony/country.rb +42 -44
  47. data/lib/phony/country_codes.rb +61 -60
  48. data/lib/phony/dsl.rb +23 -26
  49. data/lib/phony/local_splitters/fixed.rb +20 -29
  50. data/lib/phony/local_splitters/regex.rb +28 -31
  51. data/lib/phony/national_code.rb +7 -10
  52. data/lib/phony/national_splitters/default.rb +9 -11
  53. data/lib/phony/national_splitters/dsl.rb +8 -18
  54. data/lib/phony/national_splitters/fixed.rb +11 -14
  55. data/lib/phony/national_splitters/none.rb +7 -11
  56. data/lib/phony/national_splitters/regex.rb +13 -17
  57. data/lib/phony/national_splitters/variable.rb +36 -38
  58. data/lib/phony/trunk_code.rb +16 -18
  59. data/lib/phony/vanity.rb +12 -13
  60. data/lib/phony.rb +84 -84
  61. metadata +5 -39
  62. data/spec/functional/config_spec.rb +0 -44
  63. data/spec/functional/plausibility_spec.rb +0 -689
  64. data/spec/lib/phony/countries_spec.rb +0 -1459
  65. data/spec/lib/phony/country_codes_spec.rb +0 -227
  66. data/spec/lib/phony/country_spec.rb +0 -104
  67. data/spec/lib/phony/dsl_spec.rb +0 -28
  68. data/spec/lib/phony/local_splitters/fixed_spec.rb +0 -56
  69. data/spec/lib/phony/local_splitters/regex_spec.rb +0 -94
  70. data/spec/lib/phony/national_code_spec.rb +0 -61
  71. data/spec/lib/phony/national_splitters/default_spec.rb +0 -34
  72. data/spec/lib/phony/national_splitters/fixed_spec.rb +0 -45
  73. data/spec/lib/phony/national_splitters/none_spec.rb +0 -28
  74. data/spec/lib/phony/national_splitters/regex_spec.rb +0 -23
  75. data/spec/lib/phony/national_splitters/variable_spec.rb +0 -35
  76. data/spec/lib/phony/trunk_code_spec.rb +0 -85
  77. data/spec/lib/phony/vanity_spec.rb +0 -30
  78. data/spec/lib/phony_spec.rb +0 -70
@@ -1,1459 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- require 'spec_helper'
4
-
5
- describe 'country descriptions' do
6
-
7
- def self.it_splits number, expected
8
- it { expect(Phony.split(number)).to eq expected }
9
- end
10
-
11
- describe 'regression' do
12
- it_splits '33630588659', ["33", "6", "30", "58", "86", "59"]
13
- end
14
-
15
- describe 'splitting' do
16
- describe 'Ascension Island' do
17
- it_splits '2473551', ['247', false, '3551']
18
- end
19
-
20
- describe 'Afghanistan' do
21
- it_splits '93201234567', ['93', '20', '1234567'] # Kabul
22
- end
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
-
30
- describe 'Algeria' do
31
- it_splits '213211231234', ['213', '21', '123', '1234'] # Algiers
32
- it_splits '213331231234', ['213', '33', '123', '1234'] # Batna
33
- end
34
-
35
- describe 'Argentina' do
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
43
- end
44
-
45
- describe 'Austria' do
46
- it_splits '43198110', %w( 43 1 98110 ) # Vienna
47
- it_splits '4310000000', %w( 43 1 0000000 ) # Vienna
48
- it_splits '43800123456789', %w( 43 800 123456789 ) # Free
49
- it_splits '436780000000', %w( 43 678 0000 000 ) # Mobile
50
- it_splits '4368100000000', %w( 43 681 0000 0000 ) # Mobile
51
- it_splits '436880000000', %w( 43 688 0000 000 ) # Mobile
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
55
- it_splits '433161234567891', %w( 43 316 1234567891 ) # Graz
56
- it_splits '432164123456789', %w( 43 2164 123456789 ) # Rohrau
57
- it_splits '43720116987', %w( 43 720 116987 ) # VoIP
58
-
59
- # mobile numbers can have from 7 to 10 digits in the subscriber number
60
- it_splits '436641234567', %w( 43 664 1234 567 )
61
- it_splits '4366412345678', %w( 43 664 1234 5678 )
62
- it_splits '43664123456789', %w( 43 664 1234 56789 )
63
- it_splits '436641234567890', %w( 43 664 1234 567890 )
64
- end
65
-
66
- describe 'Australia' do
67
- it_splits '61512341234', ['61', '5', '1234', '1234'] # Landline
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
72
- end
73
-
74
- describe 'Bahrain' do
75
- it_splits '97312345678', ['973', false, '1234', '5678']
76
- end
77
-
78
- describe 'Bangladesh' do
79
- it_splits '88021234567', %w(880 2 1234567)
80
- it_splits '8805112345', %w(880 51 12345)
81
- it_splits '88031123456', %w(880 31 123456)
82
- it_splits '88032112345', %w(880 321 12345)
83
- it_splits '8804311234567', %w(880 431 1234567)
84
- it_splits '880902012345', %w(880 9020 12345)
85
- end
86
-
87
- describe 'Belarus' do
88
- it_splits '375152123456', %w(375 152 123456)
89
- it_splits '375151512345', %w(375 1515 12345)
90
- it_splits '375163423456', %w(375 163 423456)
91
- it_splits '375163112345', %w(375 1631 12345)
92
- it_splits '375291234567', %w(375 29 1234567)
93
- it_splits '375800123', %w(375 800 123)
94
- it_splits '3758001234', %w(375 800 1234)
95
- it_splits '3758001234567', %w(375 800 1234567)
96
- it_splits '37582012345678', %w(375 820 12345678)
97
- end
98
-
99
- describe 'Belgium' do
100
- it_splits '3235551212', ['32', '3', '555', '12', '12'] # Antwerpen
101
- it_splits '3250551212', ['32', '50', '55', '12', '12'] # Brugge
102
- it_splits '3225551212', ['32', '2', '555', '12', '12'] # Brussels
103
- it_splits '3295551914', ['32', '9', '555', '19', '14'] # Gent
104
- it_splits '3245551414', ['32', '4', '555', '14', '14'] # Liège
105
- it_splits '3216473200', ['32', '16', '47', '32', '00'] # Leuven
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)
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
121
- end
122
-
123
- describe 'Belize' do
124
- it_splits '5012051234', %w(501 205 1234)
125
- end
126
-
127
- describe 'Benin' do
128
- it_splits '22912345678', ['229', false, '1234', '5678']
129
- end
130
-
131
- describe 'Bolivia' do
132
- it_splits '59122772266', %w(591 2 277 2266)
133
- end
134
-
135
- describe 'Botswana' do
136
- it_splits '26780123456', %w(267 80 123 456)
137
- it_splits '2672956789', %w(267 29 567 89)
138
- it_splits '2674634567', %w(267 463 4567)
139
- it_splits '2675812345', %w(267 58 123 45)
140
- it_splits '26776712345', %w(267 7 6712 345)
141
- it_splits '26781234567', %w(267 8 1234 567)
142
- end
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
-
149
- describe 'Brazil' do
150
- it_splits '551122341234', ['55', '11', '2234', '1234']
151
- it_splits '5511981231234', ['55', '11', '98123', '1234'] # São Paulo's 9 digits mobile
152
- it_splits '5521981231234', ['55', '21', '98123', '1234'] # Rio de Janeiro's 9 digits mobile
153
- it_splits '551931311234', ['55', '19', '3131', '1234']
154
- it_splits '5531991311234', ['55', '31', '99131', '1234'] # Belo Horizonte's 9th digit
155
- it_splits '5571991311234', ['55', '71', '99131', '1234'] # Salvador's 9th digit
156
- it_splits '5579991311234', ['55', '79', '99131', '1234'] # Sergipe's 9th digit
157
- it_splits '5547991311234', ['55', '47', '99131', '1234'] # Santa Catarina's 9th digit
158
- it_splits '5541991311234', ['55', '41', '99131', '1234'] # Parana's 9th digit
159
- it_splits '556734212121', ['55', '67', '3421', '2121']
160
-
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|
174
- it_splits "55#{state_code}993051123", ['55', state_code, '99305', '1123']
175
- end
176
- end
177
-
178
- context "special numbers" do
179
- it_splits '5508002221234', ['55', '0800', '222', '1234']
180
- it_splits '5530032221', ['55', '3003', '2221']
181
- it_splits '5540209999', ['55', '4020', '9999']
182
- it_splits '5540038999', ['55', '4003', '8999']
183
- it_splits '5540048999', ['55', '4004', '8999']
184
- end
185
-
186
- context "service numbers" do
187
- it_splits '55100', ['55', '100', ""]
188
- it_splits '55199', ['55', '199', ""]
189
- end
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
211
- describe 'Cambodia' do
212
- it_splits '85512236142', ["855", "12", "236", "142"] # mobile (Mobitel)
213
- it_splits '855977100872', ["855", "97", "710", "0872"] # mobile (Metfone)
214
- it_splits '855234601183', ["855", "23", "460", "1183"] # Long fixed line (Phnom Penh)
215
- it_splits '85533234567', ["855", "33", "234", "567"] # Regular fixed line (Kampot)
216
- end
217
- describe 'Chile' do
218
- it_splits '5621234567', ['56', '2', '1234567'] # Santiago
219
- it_splits '5675123456', ['56', '75', '123456'] # Curico
220
- it_splits '56912345678', ['56', '9', '12345678'] # Mobile
221
- it_splits '56137123456', ['56', '137', '123', '456'] # Service
222
- end
223
- describe 'China' do
224
- it_splits '862112345678', ['86', '21', '1234', '5678'] # Shanghai
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
241
- end
242
- describe 'Colombia' do
243
- it_splits '5711234567', ['57', '1', '123', '4567'] # Outdated.
244
- it_splits '573101234567', ['57', '310', '123', '4567'] # mobile
245
- end
246
- describe 'Croatia' do
247
- it_splits '38521695900', %w( 385 21 695 900 ) # Landline
248
- it_splits '38514566666', %w( 385 1 4566 666 ) # Landline (Zagreb)
249
- it_splits '38599444999', %w( 385 99 444 999 ) # Mobile
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
255
- end
256
- describe 'Cuba' do
257
- it_splits '5351231234', ['53', '5123', '1234'] # Mobile
258
- it_splits '5371234567', ['53', '7', '1234567'] # Havana
259
- it_splits '5342123456', ['53', '42', '123456'] # Villa Clara
260
- end
261
- describe 'Cyprus' do
262
- it_splits '35712322123456', ['357', '123', '22', '123456'] # Voicemail
263
- it_splits '35722123456', ['357', '22', '123456'] # Fixed
264
- it_splits '35791123456', ['357', '91', '123456'] # Mobile
265
- end
266
- describe 'Denmark' do
267
- it_splits '4532121212', ['45', false, '32', '12', '12', '12']
268
- end
269
- describe 'Egypt' do
270
- it_splits '20212345678', ['20', '2', '12345678']
271
- it_splits '20921234567', ['20', '92', '1234567']
272
- it_splits '20951234567', ['20', '95', '1234567']
273
- end
274
- describe 'Equatorial Guinea' do
275
- it_splits '240222201123', ['240', false, '222', '201', '123']
276
- it_splits '240335201123', ['240', false, '335', '201', '123']
277
- end
278
- describe 'Estonia' do
279
- it_splits '3723212345', ['372', '321', '2345'] # Landline
280
- it_splits '37251231234', ['372', '5123', '1234'] # Mobile
281
- it_splits '3728001234', ['372', '800', '1234'] # Freephone
282
- it_splits '37281231234', ['372', '8123', '1234'] # Mobile
283
- it_splits '37282231234', ['372', '8223', '1234'] # Mobile
284
- it_splits '37252212345', ['372', '5221', '2345'] # Mobile
285
- it_splits '3725221234', ['372', '5221', '234'] # Mobile
286
- it_splits '37270121234', ['372', '7012', '1234'] # Premium
287
- end
288
- describe 'Finland' do
289
- it_splits '3589123123', ['358', '9', '123', '123'] # Helsinki
290
- it_splits '3581912312', ['358', '19', '123', '12'] # Nylandia
291
- it_splits '3585012312', ['358', '50', '123', '12'] # Mobile
292
- it_splits '35860012345', ['358', '6001', '23', '45'] # Service
293
- end
294
- describe 'France' do
295
- it_splits '33112345678', ['33', '1', '12','34','56','78'] # Paris
296
- it_splits '33812345678', ['33', '8', '12','34','56','78'] # Service number
297
- end
298
- describe 'Georgia' do
299
- it_splits '99522012345', %w(995 220 123 45)
300
- it_splits '995321234567', %w(995 32 123 4567)
301
- it_splits '995342123456', %w(995 342 123 456)
302
- it_splits '995596123456', %w(995 596 123 456)
303
- end
304
- describe 'Germany' do
305
- it_splits '493038625454', ['49', '30', '386', '25454'] # Berlin
306
- it_splits '4932221764542', ['49', '32', '221', '764542'] # Non-Geographical
307
- it_splits '4922137683323', ['49', '221', '376', '83323'] # Cologne
308
- it_splits '497614767676', ['49', '761', '476', '7676'] # Freiburg im Breisgau
309
- it_splits '4921535100', ['49', '2153', '510', '0'] # Nettetal-Lobberich
310
- it_splits '493434144602', ['49', '34341', '446', '02'] # Geithain
311
-
312
- it_splits '491805878323', ['49', '180', '587', '8323'] # Service number
313
- it_splits '491815878323', ['49', '181', '587', '8323'] # Service number
314
- it_splits '498001234567', ['49', '800', '123', '4567'] # Service number
315
- it_splits '49800222340010', ['49', '800', '222', '340010'] # Service number
316
-
317
- it_splits '4915111231234', ['49', '151', '1123', '1234'] # Mobile number
318
- it_splits '4915771231234', ['49', '1577', '123', '1234'] # Mobile number
319
- it_splits '491601234567', ['49', '160', '1234', '567'] # Mobile number
320
- it_splits '4916312345678', ['49', '163', '1234', '5678'] # Mobile number
321
- it_splits '4915211231234', ['49', '1521', '123', '1234'] # Mobile number
322
- end
323
- describe 'Ghana' do
324
- it_splits '233302123456', ['233', '30', '212', '3456'] # Mobile Vodafone, Accra
325
- end
326
- describe 'Gibraltar' do
327
- it_splits '35020012345', ['350', '200', '12345'] # Fixed
328
- it_splits '35021112345', ['350', '211', '12345'] # Fixed
329
- it_splits '35022212345', ['350', '222', '12345'] # Fixed
330
- it_splits '35054123456', ['350', '54', '123456'] # Mobile
331
- it_splits '35056123456', ['350', '56', '123456'] # Mobile
332
- it_splits '35057123456', ['350', '57', '123456'] # Mobile
333
- it_splits '35058123456', ['350', '58', '123456'] # Mobile
334
- it_splits '35060123456', ['350', '60', '123456'] # Mobile
335
- it_splits '3508012', ['350', '8012', '' ] # Freephone
336
- end
337
- describe 'Greece' do
338
- it_splits '302142345678', %w(30 21 4234 5678)
339
- it_splits '302442345678', %w(30 24 4234 5678)
340
- it_splits '305034571234', %w(30 50 3457 1234)
341
- it_splits '306901234567', %w(30 690 123 4567)
342
- it_splits '307001234567', %w(30 70 0123 4567)
343
- it_splits '308001001234', %w(30 800 100 1234)
344
- it_splits '308011001234', %w(30 801 100 1234)
345
- it_splits '308071001234', %w(30 807 100 1234)
346
- it_splits '308961001234', %w(30 896 100 1234)
347
- it_splits '309011234565', %w(30 901 123 4565)
348
- it_splits '309091234565', %w(30 909 123 4565)
349
- end
350
-
351
- describe 'Haiti' do
352
- it_splits '50922121234', ['509', '22', '12', '1234']
353
- end
354
-
355
- describe 'Hong Kong' do
356
- it_splits '85212341234', ['852', false, '1234', '1234'] #Other Numbers
357
- it_splits '852800121234', ['852', '800', '12', '1234'] #Toll Free
358
- end
359
-
360
- describe 'Hungary' do
361
- it_splits'3612345678', ['36', '1', '234', '5678']
362
- it_splits'3622123456', ['36', '22', '123', '456']
363
- end
364
- describe 'Iceland' do
365
- it_splits '354112', ['354', false, '112'] # Emergency TODO
366
- it_splits '3544211234', ['354', false, '421', '1234'] # Keflavík
367
- it_splits '3544621234', ['354', false, '462', '1234'] # Akureyri
368
- it_splits '3545511234', ['354', false, '551', '1234'] # Reykjavík
369
- end
370
- describe 'Indonesia' do
371
- it_splits '6242323032', ["62", "4", "2323", "032"]
372
- it_splits '6285220119289', ['62', '852', '2011', '9289']
373
- it_splits '62217815263', %w(62 21 781 5263)
374
- it_splits '6213123', %w(62 13 123)
375
- it_splits '6213123456', %w(62 13 123 456)
376
- it_splits '6217412', %w(62 174 12)
377
- it_splits '6217412345', %w(62 174 12 345)
378
- it_splits '6217712', %w(62 177 12)
379
- it_splits '6217712123456', %w(62 177 1212 3456)
380
- it_splits '62178123', %w(62 178 123)
381
- it_splits '6217812345', %w(62 178 123 45)
382
- it_splits '622112345', %w(62 21 123 45)
383
- it_splits '622112345567', %w(62 21 1234 5567)
384
- it_splits '622212345', %w(62 22 123 45)
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)
388
- it_splits '624311234', %w(62 4 311 234)
389
- it_splits '62431123456', %w(62 4 3112 3456)
390
- it_splits '6262212345', %w(62 6 221 2345)
391
- it_splits '62622123456', %w(62 6 2212 3456)
392
- it_splits '6270123456', %w(62 70 123 456)
393
- it_splits '6271123456', %w(62 71 123 456)
394
- it_splits '62711234567', %w(62 71 123 4567)
395
- it_splits '62810123456', %w(62 810 123 456)
396
- it_splits '6281012345678', %w(62 810 1234 5678)
397
- it_splits '628151234567', %w(62 815 123 4567)
398
- it_splits '62820123456', %w(62 820 123 456)
399
- it_splits '628231234567', %w(62 823 123 4567)
400
- it_splits '6282312345678', %w(62 823 1234 5678)
401
- it_splits '6287012345', %w(62 870 123 45)
402
- it_splits '62877123456', %w(62 877 123 456)
403
- it_splits '62881123456', %w(62 881 123 456)
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)
407
- it_splits '6291234567', %w(62 9 1234 567)
408
- it_splits '629123456789', %w(62 9 123 456 789)
409
- end
410
-
411
- describe 'India' do
412
- it_splits '919911182111', ['91', '99', '111', '82', '111'] # mobile
413
- it_splits '912212345678', ['91', '22', '123', '45', '678'] # New Delhi
414
- it_splits '911411234567', ['91', '141', '123', '45', '67'] # Jaipur
415
- it_splits '913525123456', ['91', '3525', '123', '456'] # DALKHOLA
416
- it_splits '914433993939', ['91', '44', '339', '93', '939'] #
417
- end
418
-
419
- describe 'Iran' do
420
- it_splits '982112341234', ['98', '21', '1234', '1234'] # Teheran
421
- it_splits '989191231234', ['98', '919', '123', '1234'] # Example Cell Phone
422
- end
423
-
424
- describe 'Ireland' do
425
- it_splits '35311234567', ['353', '1', '123', '4567'] # Dublin, 7 digit subscriber #
426
- it_splits '353539233333', ['353', '53', '923', '3333'] # Wexford, 7 digit subscriber
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 #
429
- it_splits '35345123456', ['353', '45', '123456'] # Naas, 6 digit subscriber #
430
- it_splits '353801234567', ['353', '80', '123', '4567'] # Mobile
431
- it_splits '353761234567', ['353', '76', '123', '4567'] # VoIP
432
- it_splits '353800123456', ['353', '800', '123456'] # Freefone
433
- it_splits '353000123456', ['353', '000', '123456'] # Default fixed 3 split for unrecognized
434
- end
435
-
436
- describe 'Israel (972)' do
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
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)
447
- end
448
- describe 'Israel (970)' do
449
- it_splits '97021231234', ['970', '2', '123', '1234'] # Jerusalem Area
450
- it_splits '97082411234', ['970', '8', '241', '1234'] # Gaza Strip (Palestine)
451
- it_splits '97091231234', ['970', '9', '123', '1234'] # Sharon Area
452
- it_splits '970501231234', ['970', '50', '123', '1234'] # Mobile (Pelephone)
453
- it_splits '970591231234', ['970', '59', '123', '1234'] # Mobile Jawwal (Palestine)
454
- it_splits '970771231234', ['970', '77', '123', '1234'] # Cable Phone Services
455
- it_splits '9701700123123', ['970', '1', '700', '123', '123'] # Cable Phone Services
456
- end
457
- describe 'Italy' do
458
- it_splits '39348695281', ['39', '348', '695', '281'] # Mobile (6-digit subscriber no. - rare, but still used)
459
- it_splits '393486952812', ['39', '348', '695', '2812'] # Mobile (7-digit subscriber no. - common)
460
- it_splits '3934869528123',['39', '348', '695', '2812', '3'] # Mobile (8-digit subscriber no - new)
461
- it_splits '393357210488', ['39', '335', '721', '0488'] # Mobile
462
- it_splits '393248644272', ['39', '324', '864', '4272'] # Mobile
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
470
- it_splits '390141595661', ['39', '0141', '595', '661'] # Asti
471
- it_splits '3903123391', ['39', '031', '23391'] # Como
472
- it_splits '390909709511', ['39', '090', '9709511'] # Barcellona
473
- it_splits '390471811353', ['39', '0471', '811', '353'] # Bolzano
474
- it_splits '3905745730', ['39', '0574', '5730'] # Prato
475
- end
476
- describe 'Japan' do
477
- it_splits '81312345678', %w(81 3 1234 5678) # Tokyo
478
- it_splits '81612345678', %w(81 6 1234 5678) # Osaka
479
- it_splits '818001001234', %w(81 800 100 1234) # Freephone
480
- it_splits '81120123456', %w(81 120 123 456) # Freephone
481
- it_splits '81111234567', %w(81 11 123 4567)
482
- it_splits '81123123456', %w(81 123 12 3456)
483
- it_splits '81126712345', %w(81 1267 1 2345)
484
- it_splits '812012345678', %w(81 20 1234 5678) # Pager(Calling Party Pay)
485
- it_splits '815012345678', %w(81 50 1234 5678) # IP Telephone
486
- it_splits '816012345678', %w(81 60 1234 5678) # UPT
487
- it_splits '817012345678', %w(81 70 1234 5678) # PHS
488
- it_splits '818012345678', %w(81 80 1234 5678) # Cellular
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
492
- end
493
- describe 'Kenya' do
494
- it_splits '254201234567', ['254', '20', '1234567'] # Nairobi
495
- it_splits '254111234567', ['254', '11', '1234567'] # Mombasa
496
- it_splits '254723100220', ['254', '723', '100220'] # Mombasa
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
502
- describe 'Kyrgyzstan' do
503
- it_splits '996312212345', %w(996 312 212 345)
504
- it_splits '996315212345', %w(996 315 212 345)
505
- it_splits '996313121234', %w(996 3131 212 34)
506
- it_splits '996394621234', %w(996 3946 212 34)
507
- it_splits '996501234567', %w(996 50 123 4567)
508
- it_splits '996521234567', %w(996 52 123 4567)
509
- it_splits '996581234567', %w(996 58 123 4567)
510
- it_splits '996800123456', %w(996 800 123 456)
511
- end
512
- describe 'Lithuania' do
513
- it_splits '37070012123', ['370', '700', '12', '123'] # Service
514
- it_splits '37061212123', ['370', '612', '12', '123'] # Mobile
515
- it_splits '37051231212', ['370', '5', '123', '12', '12'] # Vilnius
516
- it_splits '37037121212', ['370', '37', '12', '12', '12'] # Kaunas
517
- it_splits '37044011212', ['370', '440', '1', '12', '12'] # Skuodas
518
- end
519
- describe 'Luxembourg' do
520
- it_splits '352222809', ['352', '22', '28', '09']
521
- it_splits '35226222809', ['352', '2622', '28', '09']
522
- it_splits '352621123456', ['352', '621', '123', '456']
523
- it_splits '3524123456', ['352', '41', '23', '45', '6']
524
- it_splits '352602112345678', ['352', '6021', '12', '34', '56', '78']
525
- it_splits '352370431', ['352', '37', '04', '31']
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
- it_splits '3522634731', ['352', '26', '34', '73', '1']
532
- it_splits '352264412701', ['352', '26', '44', '12', '701']
533
- end
534
- describe 'Macedonia' do
535
- it_splits '38921234567', ['389', '2', '123', '4567'] # Skopje
536
- it_splits '38931234567', ['389', '3', '123', '4567'] # Eastern Macedonia
537
- it_splits '38941234567', ['389', '4', '123', '4567'] # Western Macedonia
538
- it_splits '38951234567', ['389', '5', '123', '4567'] # Premium
539
- it_splits '38971234567', ['389', '7', '123', '4567'] # Mobile
540
- end
541
- describe 'Macao' do
542
- it_splits '85328123456', ["853", "28", "12", "3456"] # Landline
543
- it_splits '85381234567', ["853", "8", "123", "4567"] # Landline
544
- it_splits '85361234567', ["853", "6", "123", "4567"] # Mobile
545
- end
546
- describe 'Malaysia' do
547
- it_splits '6082123456', ['60', '82', '123456'] # Kuching
548
- it_splits '60312345678', ['60', '3', '12345678'] # Kuala Lumpur
549
- it_splits '60212345678', ['60', '2', '12345678'] # Singapore
550
- it_splits '60111231234', ['60', '11', '123', '1234'] # Mobile
551
- it_splits '601112312345', ['60', '11', '123', '12345'] # Mobile
552
- it_splits '60800121234', ['60', '800', '12', '1234'] # Freephone
553
- # it_splits '60112', ['60', '112'] # Service
554
- end
555
- describe 'Malta' do
556
- it_splits '35621231234', ['356', '2123', '1234'] # Fixed
557
- it_splits '35677123456', ['356', '77', '123456'] # Mobile
558
- it_splits '35698123456', ['356', '98', '123456'] # Mobile
559
- it_splits '35651231234', ['356', '5123', '1234'] # Voice Mail
560
- end
561
- describe 'Mexico' do
562
- it_splits '525512121212', ['52', '55', '1212', '1212'] # Mexico City
563
- it_splits '5215512121212', ['52', '1', '55', '1212', '1212'] # Mexico City cell phone from abroad
564
- it_splits '526641231212', ['52', '664', '123', '1212'] # Tijuana
565
- it_splits '5216641231212', ['52', '1', '664', '123', '1212'] # Tijuana cell phone from abroad
566
- it_splits '520446641231212', ['52', '044', '664', '123', '1212'] # Tijuana cell phone local from landline
567
- end
568
- describe 'Monaco' do
569
- it_splits '37741123456', ['377', '41', '12', '34', '56'] # Mobile
570
- it_splits '377612345678', ['377', '6', '12', '34', '56', '78'] # Mobile
571
- end
572
- describe 'Montenegro' do
573
- it_splits '38280123456', %w(382 80 123 456)
574
- it_splits '3822012345', %w(382 20 123 45)
575
- it_splits '38220123456', %w(382 20 123 456)
576
- it_splits '38232123456', %w(382 32 123 456)
577
- it_splits '38278103456', %w(382 78 103 456)
578
- it_splits '38263123', %w(382 63 123)
579
- it_splits '382631234567890', %w(382 63 123 456 7890)
580
- it_splits '38277103456', %w(382 77 103 456)
581
- it_splits '38294103456', %w(382 94 103 456)
582
- it_splits '38288103456', %w(382 88 103 456)
583
- it_splits '3826812', %w(382 68 12)
584
- it_splits '382681212345678', %w(382 68 12 1234 5678)
585
- it_splits '38270123', %w(382 70 123)
586
- it_splits '382701234567890', %w(382 70 123 456 7890)
587
- end
588
- describe 'Morocco' do
589
- it_splits '212537718685', ['212', '53', '7718', '685']
590
- it_splits '212612345678', ['212', '6', '12', '34', '56', '78']
591
- end
592
- describe 'The Netherlands' do
593
- it_splits '31612345678', ['31', '6', '12', '34', '56', '78'] # mobile
594
- it_splits '31201234567', ['31', '20', '123', '4567']
595
- it_splits '31222123456', ['31', '222', '123', '456']
596
- it_splits '3197012345678', ['31', '970', '1234', '5678'] # machine-to-machine
597
- end
598
- describe 'Norfolk Island' do
599
- it_splits '672321234', ['672', '3', '21', '234'] # fixed
600
- it_splits '672351234', ['672', '3', '51', '234'] # mobile
601
- end
602
- describe 'Norway' do
603
- it_splits '4721234567', ['47',false,'21','23','45','67']
604
- it_splits '4731234567', ['47',false,'31','23','45','67']
605
- it_splits '4741234567', ['47',false,'412','34','567']
606
- it_splits '4751234567', ['47',false,'51','23','45','67']
607
- it_splits '4761234567', ['47',false,'61','23','45','67']
608
- it_splits '4771234567', ['47',false,'71','23','45','67']
609
- it_splits '4781234567', ['47',false,'812','34','567']
610
- it_splits '4791234567', ['47',false,'912','34','567']
611
- end
612
- describe 'Oman' do
613
- it_splits '96824423123', %w(968 24 423 123)
614
- it_splits '96825423123', %w(968 25 423 123)
615
- end
616
- describe 'Pakistan' do
617
- it_splits '922112345678', %w(92 21 1234 5678)
618
- it_splits '92221234567', %w(92 22 1234 567)
619
- it_splits '92232123456', %w(92 232 123 456)
620
- it_splits '923012345678', %w(92 30 1234 5678)
621
- end
622
- describe 'Paraguay (Republic of)' do
623
- it_splits '59521123456', %w(595 21 123 456)
624
- it_splits '595211234567', %w(595 21 123 4567)
625
- it_splits '595345123456', %w(595 345 123 456)
626
- it_splits '595961611234', %w(595 96 161 1234)
627
- end
628
- describe 'Peru' do
629
- it_splits '5111231234', ['51', '1', '123', '1234'] # Lima
630
- it_splits '51912341234', ['51', '9', '1234', '1234'] # mobile
631
- it_splits '5184123123', ['51', '84', '123', '123'] # Cuzco, best effort
632
- end
633
- describe 'Philippines' do
634
- it_splits '6321234567', ['63', '2', '1234567']
635
- it_splits '63289889999', ['63', '2', '89889999']
636
- it_splits '6321234567890', ['63', '2', '1234567890']
637
- it_splits '632123456789012', ['63', '2', '123456789012']
638
- it_splits '639121234567', ['63', '912', '1234567']
639
- it_splits '63881234567', ['63', '88', '1234567']
640
- end
641
- describe 'Poland' do
642
- it_splits '48123456789', ['48', '12', '345', '67', '89'] # Landline
643
- it_splits '48501123456', ['48', '501', '123', '456'] # Mobile
644
- it_splits '48571123456', ['48', '571', '123', '456'] # Mobile
645
- it_splits '48451123456', ['48', '451', '123', '456'] # Mobile
646
- it_splits '48800123456', ['48', '800', '123', '456'] # Free
647
- it_splits '48801123456', ['48', '801', '123', '456'] # Shared cost
648
- it_splits '48701123456', ['48', '701', '123', '456'] # Premium
649
- end
650
- describe 'Portugal' do
651
- it_splits '351211231234', ['351', '21', '123', '1234'] # Lisboa
652
- it_splits '351241123123', ['351', '241', '123', '123'] # Abrantes
653
- it_splits '351931231234', ['351', '93', '123', '1234'] # mobile
654
- end
655
- describe 'Qatar' do
656
- it_splits '9741245123456', %w(974 1245 123 456)
657
- it_splits '9742613456', %w(974 26 134 56)
658
- it_splits '97433123456', %w(974 33 123 456)
659
- it_splits '97444412456', %w(974 44 412 456)
660
- it_splits '9748001234', %w(974 800 12 34)
661
- it_splits '9749001234', %w(974 900 12 34)
662
- it_splits '97492123', %w(974 92 123)
663
- it_splits '97497123', %w(974 97 123)
664
- end
665
- describe 'Romania' do
666
- it_splits '40211231234', ['40', '21', '123', '1234'] # Bucureşti
667
- it_splits '40721231234', ['40', '72', '123', '1234'] # mobile
668
- it_splits '40791231234', ['40', '79', '123', '1234'] # mobile
669
- it_splits '40249123123', ['40', '249', '123', '123'] # Olt
670
- end
671
-
672
- describe 'Russia' do
673
- it_splits '78122345678', ['7', '812', '234', '56', '78'] # Russia 3-digit
674
- it_splits '74012771077', ['7', '4012', '77', '10', '77'] # Russia 4-digit
675
- it_splits '78402411212', ['7', '84024', '1', '12', '12'] # Russia 5-digit
676
- it_splits '79296119119', ['7', '929', '611', '91', '19'] # Russia 3-digit, Megafon Mobile
677
- it_splits '79691234567', ['7', '969', '123', '45', '67'] # Russia 3-digit, Beeline
678
- it_splits '79771234567', ['7', '977', '123', '45', '67'] # Russia 3-digit
679
- it_splits '79961234567', ['7', '996', '123', '45', '67'] # Russia 3-digit
680
- it_splits '79991234567', ['7', '999', '123', '45', '67'] # Russia 3-digit
681
- it_splits '7840121212', ['7', '840', '12', '1212'] # Abhasia
682
- it_splits '7799121212', ['7', '799', '12', '1212'] # Kazachstan
683
- it_splits '7995344121212', ['7', '995', '344','12','1212'] # South Osetia
684
- it_splits '7209175276', ['7', '209', '17', '5276'] # Fantasy number
685
- end
686
-
687
- describe 'Rwanda' do
688
- it_splits '250781234567', ['250', '78', '1234567'] # mobile
689
- it_splits '250721234567', ['250', '72', '1234567'] # mobile
690
- it_splits '250731234567', ['250', '73', '1234567'] # mobile
691
- it_splits '250791234567', ['250', '79', '1234567'] # mobile
692
- it_splits '250251234567', ['250', '25', '1234567'] # fixed
693
- it_splits '25006123456', ['250', '06', '123456'] # fixed
694
- end
695
- describe 'Sao Tome and Principe' do
696
- it_splits '2392220012', %w(239 2 220 012)
697
- it_splits '2399920012', %w(239 9 920 012)
698
- end
699
- describe 'South Korea' do
700
- it_splits '82212345678', ['82', '2', '1234', '5678'] # Seoul (8 digits)
701
- it_splits '8227111222', ['82', '2', '711', '1222'] # Seoul (7 digits)
702
- it_splits '825112345678', ['82', '51', '1234', '5678'] # Busan (8 digits)
703
- it_splits '82511234567', ['82', '51', '123', '4567'] # Busan (7 digits)
704
- it_splits '821027975588', ['82', '10', '2797', '5588'] # mobile
705
- it_splits '821087971234', ['82', '10', '8797', '1234'] # mobile
706
- end
707
- describe 'Serbia' do
708
- it_splits '38163512529', ['381', '63', '512', '529']
709
- end
710
- describe 'South Sudan' do
711
- it_splits '211123212345', ['211', '123', '212', '345']
712
- it_splits '211973212345', ['211', '973', '212', '345']
713
- end
714
- describe 'Sudan' do
715
- it_splits '249187171100', ['249', '18', '717', '1100']
716
- end
717
- describe 'Thailand' do
718
- it_splits '6621231234', ['66', '2', '123', '1234'] # Bangkok
719
- it_splits '6636123123', ['66', '36', '123', '123'] # Lop Buri
720
- it_splits '66851234567', ['66', '851', '234', '567'] # Lop Buri
721
- it_splits '66921234567', ['66', '921', '234', '567'] # mobile
722
- end
723
- describe 'Tunesia' do
724
- it_splits '21611231234', ['216', '1', '123', '1234'] # Ariana
725
- it_splits '21621231234', ['216', '2', '123', '1234'] # Bizerte
726
- end
727
- describe 'Salvador (El)' do
728
- it_splits '50321121234', ['503', '2112', '1234'] # Fixed number
729
- it_splits '50361121234', ['503', '6112', '1234'] # Mobile number
730
- end
731
-
732
- describe 'Singapore' do
733
- it_splits '6561231234', ['65', false, '6123', '1234'] # Fixed line
734
- it_splits '658008521234', ['65', false, '800', '852', '1234'] # International Toll Free Service (ITFS) and Home Country Direct Service (HCDS) Numbers
735
- end
736
- describe 'Slovakia' do
737
- it_splits '421912123456', ['421', '912', '123456'] # Mobile
738
- it_splits '421212345678', ['421', '2', '12345678'] # Bratislava
739
- it_splits '4212123', ['421', '2', '123'] # Bratislava Short
740
- it_splits '421371234567', ['421', '37', '1234567'] # Nitra / Other
741
- it_splits '42137123', ['421', '37', '123'] # Nitra / Other Short
742
- end
743
-
744
- describe 'Slovenia' do
745
- it_splits '38651234567', ['386', '51', '234', '567'] # Mobile
746
- it_splits '38611234567', ['386', '1', '123', '4567'] # LJUBLJANA
747
- end
748
-
749
- describe 'Spain' do
750
- it_splits '34600123456', ['34', '600', '123', '456'] # Mobile
751
- it_splits '34900123456', ['34', '900', '123', '456'] # Special
752
- it_splits '34931234567', ['34', '93', '123', '45', '67'] # Landline large regions
753
- it_splits '34975123456', ['34', '975', '12', '34', '56'] # Landline
754
- it_splits '34123456789', ['34', '123', '456', '789'] # Default
755
- end
756
-
757
- describe 'Sri Lanka' do
758
- it_splits '94711231212', ['94', '71', '123', '12', '12'] # Mobile
759
- end
760
-
761
- describe 'Sweden' do
762
- it_splits '46812345678', ['46', '8', '123', '45', '678'] # Stockholm
763
- it_splits '46111234567', ['46', '11', '123', '45', '67']
764
- it_splits '46721234567', ['46', '72', '123', '45', '67'] # mobile
765
- it_splits '46791234567', ['46', '79', '123', '45', '67'] # mobile
766
- it_splits '46125123456', ['46', '125', '12', '34', '56']
767
- it_splits '46770820180', ['46', '77', '082', '01', '80']
768
- it_splits '4641712345', ['46', '417', '123', '45']
769
- it_splits '46513123456', ['46', '513', '12', '34', '56']
770
- end
771
- describe 'Switzerland' do
772
- it_splits '41443643532', ['41', '44', '364', '35', '32'] # Zurich (usually)
773
- it_splits '41800334455', ['41', '800', '334', '455'] # Service number
774
- it_splits '41860443643532', ['41', '860', '44', '364', '35', '32'] # Voicemail access
775
- it_splits '41900123456', ['41', '900', '123', '456'] # Business Number
776
- it_splits '41901123456', ['41', '901', '123', '456'] # Business Number Entertainment
777
- it_splits '41906123456', ['41', '906', '123', '456'] # Business Number Adult Entertainment
778
- end
779
- describe 'Tanzania' do
780
- it_splits '255221231234', ['255', '22', '123', '1234'] # Dar Es Salaam
781
- it_splits '255651231234', ['255', '65', '123', '1234'] # TIGO
782
- it_splits '255861123123', ['255', '861', '123', '123'] # Special Rates
783
- end
784
- describe 'Turkey' do
785
- it_splits '903121234567', ['90', '312', '123', '4567'] # Ankara
786
- end
787
- describe 'Uganda' do
788
- it_splits '256414123456', ['256', '41', '4123456'] # Kampania
789
- it_splits '256464441234', ['256', '464', '441234'] # Mubende
790
- end
791
- describe 'The UK' do
792
- it_splits '442075671113', ['44', '20', '7567', '1113'] # [2+8] London
793
- it_splits '442920229901', ['44', '29', '2022', '9901'] # [2+8] Cardiff
794
- it_splits '441134770011', ['44', '113', '477', '0011'] # [3+7] Leeds
795
- it_splits '441412770022', ['44', '141', '277', '0022'] # [3+7] Glasgow
796
- it_splits '441204500532', ['44', '1204', '500532'] # [4+6] Bolton
797
- it_splits '44120462532', ['44', '1204', '62532'] # [4+5] Bolton
798
- it_splits '441333247700', ['44', '1333', '247700'] # [4+6] Leven (Fife)
799
- it_splits '441382229845', ['44', '1382', '229845'] # [4+6] Dundee
800
- it_splits '441420700378', ['44', '1420', '700378'] # [4+6] Alton
801
- it_splits '44142080378', ['44', '1420', '80378'] # [4+5] Alton
802
- it_splits '441475724688', ['44', '1475', '724688'] # [4+6] Greenock
803
- it_splits '441539248756', ['44', '1539', '248756'] # [4+6] Kendal (Mixed area)
804
- it_splits '441539648788', ['44', '15396', '48788'] # [5+5] Sedbergh (Mixed area)
805
- it_splits '441652757248', ['44', '1652', '757248'] # [4+6] Brigg
806
- it_splits '441664333456', ['44', '1664', '333456'] # [4+6] Melton Mowbray
807
- it_splits '441697222555', ['44', '1697', '222555'] # [4+6] Brampton (Mixed area)
808
- it_splits '441697388555', ['44', '16973', '88555'] # [5+5] Wigton (Mixed area)
809
- it_splits '441697433777', ['44', '16974', '33777'] # [5+5] Raughton Head (Mixed area)
810
- it_splits '44169772333', ['44', '16977', '2333'] # [5+4] Brampton (Mixed area)
811
- it_splits '441697744888', ['44', '16977', '44888'] # [5+5] Brampton (Mixed area)
812
- it_splits '441757850526', ['44', '1757', '850526'] # [4+6] Selby
813
- it_splits '441890234567', ['44', '1890', '234567'] # [4+6] Coldstream (ELNS area)
814
- it_splits '441890595378', ['44', '1890', '595378'] # [4+6] Ayton (ELNS area)
815
- it_splits '441931306526', ['44', '1931', '306526'] # [4+6] Shap
816
- it_splits '441946555777', ['44', '1946', '555777'] # [4+6] Whitehaven (Mixed area)
817
- it_splits '44194662888', ['44', '1946', '62888'] # [4+5] Whitehaven (Mixed area)
818
- it_splits '441946722444', ['44', '19467', '22444'] # [5+5] Gosforth (Mixed area)
819
- it_splits '441987705337', ['44', '1987', '705337'] # [4+6] Ebbsfleet
820
- it_splits '443005828323', ['44', '300', '582', '8323'] # Non-geographic (NTS)
821
- it_splits '443334253344', ['44', '333', '425', '3344'] # Non-geographic (NTS)
822
- it_splits '443437658834', ['44', '343', '765', '8834'] # Non-geographic (NTS)
823
- it_splits '443452273512', ['44', '345', '227', '3512'] # Non-geographic (NTS)
824
- it_splits '443707774444', ['44', '370', '777', '4444'] # Non-geographic (NTS)
825
- it_splits '443725247722', ['44', '372', '524', '7722'] # Non-geographic (NTS)
826
- it_splits '44500557788', ['44', '500', '557788'] # Freefone (500 + 6)
827
- it_splits '445575671113', ['44', '55', '7567', '1113'] # Corporate numbers
828
- it_splits '445644775533', ['44', '56', '4477', '5533'] # LIECS/VoIP
829
- it_splits '447020229901', ['44', '70', '2022', '9901'] # Personal numbers
830
- it_splits '447688554246', ['44', '76', '8855', '4246'] # Pager
831
- it_splits '447180605207', ['44', '7180', '605207'] # Mobile
832
- it_splits '447480605207', ['44', '7480', '605207'] # Mobile
833
- it_splits '447624605207', ['44', '7624', '605207'] # Mobile (Isle of Man)
834
- it_splits '447780605207', ['44', '7780', '605207'] # Mobile
835
- it_splits '447980605207', ['44', '7980', '605207'] # Mobile
836
- it_splits '44800557788', ['44', '800', '557788'] # Freefone (800 + 6)
837
- it_splits '448084682355', ['44', '808', '468', '2355'] # Freefone (808 + 7)
838
- it_splits '448005878323', ['44', '800', '587', '8323'] # Freefone (800 + 7), regression
839
- it_splits '448437777334', ['44', '843', '777', '7334'] # Non-geographic (NTS)
840
- it_splits '448457777334', ['44', '845', '777', '7334'] # Non-geographic (NTS)
841
- it_splits '448707777334', ['44', '870', '777', '7334'] # Non-geographic (NTS)
842
- it_splits '448727777334', ['44', '872', '777', '7334'] # Non-geographic (NTS)
843
- it_splits '449052463456', ['44', '905', '246', '3456'] # Non-geographic (PRS)
844
- it_splits '449122463456', ['44', '912', '246', '3456'] # Non-geographic (PRS)
845
- it_splits '449832463456', ['44', '983', '246', '3456'] # Non-geographic (SES)
846
- end
847
- describe 'US' do
848
- it_splits '15551115511', ['1', '555', '111', '5511']
849
- end
850
- describe 'Venezuela' do
851
- it_splits '582121234567', ['58', '212', '1234567']
852
- end
853
- describe 'Vietnam' do
854
- it_splits '8498123456', ['84', '98', '123456'] # Viettel Mobile
855
- it_splits '8499612345', ['84', '99', '612345'] # GTel
856
- it_splits '842421234567', ['84', '24', '2123', '4567'] # Hanoi
857
- it_splits '842841234567', ['84', '28', '4123', '4567'] # Ho Chi Minh City
858
- it_splits '84341234567', ['84', '34', '1234567'] # Viettel
859
- it_splits '84841234567', ['84', '84', '1234567'] # Vinaphone
860
- it_splits '8419001212', ['84', '1900', '1212'] # Vinaphone
861
- it_splits '841900541234', ['84', '1900', '541234'] # Vinaphone
862
- end
863
- describe 'Zambia' do
864
- it_splits '260211123456', ['260', '211', '123456'] # Fixed
865
- it_splits '260955123456', ['260', '95', '512', '3456'] # Mobile
866
- it_splits '260967123456', ['260', '96', '712', '3456'] # Mobile
867
- it_splits '260978123456', ['260', '97', '812', '3456'] # Mobile
868
- it_splits '260800123456', ['260', '800', '123', '456'] # Toll free
869
- end
870
- describe 'New Zealand' do
871
- it_splits '6491234567', ['64', '9', '123', '4567']
872
- it_splits '64800123123', ['64', '800', '123', '123']
873
- it_splits '648001231234', ['64', '800', '123', '1234']
874
- end
875
- describe 'Bhutan (Kingdom of)' do
876
- it_splits '9759723642', %w(975 9 723 642)
877
- end
878
- describe 'Brunei Darussalam' do
879
- it_splits '6737932744', %w(673 7 932 744)
880
- end
881
- describe 'Burkina Faso' do
882
- it_splits '22667839323', ['226', false, '67', '83', '93', '23']
883
- it_splits '22601234567', ['226', false, '01', '23', '45', '67'] # 0 not removed.
884
- end
885
- describe 'Burundi' do
886
- it_splits '25712345678', ['257', false, '1234', '5678']
887
- end
888
- describe 'Cameroon' do
889
- it_splits '237276593812', ['237', false, '276', '59', '38', '12']
890
- end
891
- describe 'Cape Verde' do
892
- it_splits '2385494177', ['238', false, '549', '4177']
893
- end
894
- describe 'Central African Republic' do
895
- it_splits '23612345678', ['236', false, '1234', '5678']
896
- end
897
- describe 'Chad' do
898
- it_splits '23512345678', ['235', false, '1234', '5678']
899
- end
900
- describe 'Comoros' do
901
- it_splits '2693901234', ['269', false, '3901', '234']
902
- it_splits '2693401234', ['269', false, '3401', '234']
903
- end
904
- describe 'Congo' do
905
- it_splits '242123456789', ['242', false, '1234', '56789']
906
- end
907
- describe 'Cook Islands' do
908
- it_splits '68251475', ['682', false, '51', '475']
909
- end
910
- describe 'Costa Rica' do
911
- it_splits '50622345678', %w(506 2 234 5678)
912
- end
913
- describe "Côte d'Ivoire" do
914
- it_splits '2250107335518', ['225', '01', '07', '33', '55', '18']
915
- it_splits '2250237335518', ['225', '02', '37', '33', '55', '18']
916
- end
917
- describe 'Democratic Republic of Timor-Leste' do
918
- it_splits '6701742945', ['670', false, '174', '2945']
919
- end
920
- describe 'Democratic Republic of the Congo' do
921
- it_splits '243121995381', %w(243 12 199 5381)
922
- end
923
- describe 'Diego Garcia' do
924
- it_splits '2461234683', ['246', false, '123', '4683']
925
- end
926
- describe 'Djibouti' do
927
- it_splits '25349828978', ['253', false, '4982', '8978']
928
- end
929
- describe 'Ecuador' do
930
- it_splits '593220000000', %w(593 22 000 0000)
931
- it_splits '59322000000', %w(593 2 200 0000)
932
- it_splits '593230000000', %w(593 23 000 0000)
933
- it_splits '59323000000', %w(593 2 300 0000)
934
- it_splits '59324000000', %w(593 2 400 0000)
935
- it_splits '59325000000', %w(593 2 500 0000)
936
- it_splits '593260000000', %w(593 26 000 0000)
937
- it_splits '59327000000', %w(593 2 700 0000)
938
- it_splits '593270000000', %w(593 27 000 0000)
939
- it_splits '59330000000', %w(593 3 000 0000)
940
- it_splits '59340000000', %w(593 4 000 0000)
941
- it_splits '593440000000', %w(593 44 000 0000)
942
- it_splits '593450000000', %w(593 45 000 0000)
943
- it_splits '59345000000', %w(593 4 500 0000)
944
- it_splits '59346000000', %w(593 4 600 0000)
945
- it_splits '593470000000', %w(593 47 000 0000)
946
- it_splits '59352000000', %w(593 5 200 0000)
947
- it_splits '59353000000', %w(593 5 300 0000)
948
- it_splits '59362000000', %w(593 6 200 0000)
949
- it_splits '59372000000', %w(593 7 200 0000)
950
- it_splits '59373000000', %w(593 7 300 0000)
951
- it_splits '59374000000', %w(593 7 400 0000)
952
- it_splits '59376000000', %w(593 7 600 0000)
953
- it_splits '593900000000', %w(593 9 0000 0000)
954
- end
955
- describe 'Eritrea' do
956
- it_splits '2916537192', %w(291 6 537 192)
957
- end
958
- describe 'Ethiopia' do
959
- it_splits '251721233486', %w(251 72 123 3486)
960
- end
961
- describe 'Falkland Islands (Malvinas)' do
962
- it_splits '50014963', ['500', false, '14', '963']
963
- end
964
- describe 'Faroe Islands' do
965
- it_splits '298997986', ['298', false, '997', '986']
966
- end
967
- describe 'Fiji (Republic of)' do
968
- it_splits '6798668123', ['679', false, '866', '8123']
969
- end
970
- describe 'French Guiana (French Department of)' do
971
- it_splits '594594123456', %w(594 594 123 456)
972
- end
973
- describe "French Polynesia (Territoire français d'outre-mer)" do
974
- it_splits '68921988900', ['689', false, '21', '98', '89', '00']
975
- end
976
- describe 'Gabonese Republic' do
977
- it_splits '2411834375', ['241', '1', '834', '375']
978
- it_splits '24174012345', ['241', '74', '01', '23', '45']
979
- end
980
- describe 'Gambia' do
981
- it_splits '2206683355', ['220', false, '668', '3355']
982
- end
983
- describe 'Greenland' do
984
- it_splits '299314185', ['299', '31', '4185']
985
- it_splits '299691123', ['299', '691', '123']
986
- end
987
- describe 'Guadeloupe (French Department of)' do
988
- it_splits '590590456789', %w(590 590 45 67 89)
989
- end
990
- describe 'Guatemala (Republic of)' do
991
- it_splits '50219123456789', ['502', '19', '123', '456', '789']
992
- it_splits '50221234567', ['502', '2', '123', '4567']
993
- end
994
- describe 'Guinea' do
995
- it_splits '22430311234', ['224', '3031', '12', '34']
996
- it_splits '224662123456', ['224', '662', '12', '34', '56']
997
- end
998
- describe 'Guinea-Bissau' do
999
- it_splits '245443837652', ['245', false, '44', '383', '7652']
1000
- end
1001
- describe 'Guyana' do
1002
- it_splits '5922631234', %w(592 263 1234)
1003
- end
1004
- describe 'Honduras (Republic of)' do
1005
- it_splits '50412961637', %w(504 12 961 637)
1006
- end
1007
- describe 'Iraq' do
1008
- it_splits '96411234567', %w(964 1 123 4567)
1009
- it_splits '96421113456', %w(964 21 113 456)
1010
- it_splits '9647112345678', %w(964 71 1234 5678)
1011
- end
1012
- describe 'Jordan (Hashemite Kingdom of)' do
1013
- it_splits '96280012345', %w(962 800 123 45)
1014
- it_splits '96226201234', %w(962 2 620 1234)
1015
- it_splits '962712345678', %w(962 7 1234 5678)
1016
- it_splits '962746612345', %w(962 7 4661 2345)
1017
- it_splits '96290012345', %w(962 900 123 45)
1018
- it_splits '96285123456', %w(962 85 123 456)
1019
- it_splits '96270123456', %w(962 70 123 456)
1020
- it_splits '96262501456', %w(962 6250 1456)
1021
- it_splits '96287901456', %w(962 8790 1456)
1022
- end
1023
- describe 'Kiribati (Republic of)' do
1024
- it_splits '68634814527', ['686', false, '34814527']
1025
- end
1026
- describe "Democratic People's Republic of Korea" do
1027
- it_splits '850212345', %w(850 2 123 45)
1028
- it_splits '8502123456789', %w(850 2 123 456 789)
1029
- it_splits '85023812356', %w(850 2 381 2356)
1030
- #it_splits '85028801123456781256', %w(850 2 8801 1234 5678 1256)
1031
- it_splits '8501911234567', %w(850 191 123 4567)
1032
- end
1033
- describe 'Kuwait (State of)' do
1034
- it_splits '96523456789', ['965', false, '2345', '6789']
1035
- it_splits '9651812345', ['965', false, '181', '2345']
1036
- end
1037
- describe "Lao People's Democratic Republic" do
1038
- it_splits '85697831195', %w(856 97 831 195)
1039
- end
1040
- describe 'Latvia' do
1041
- it_splits '37180123456', %w(371 801 234 56)
1042
- it_splits '37163723456', %w(371 637 234 56)
1043
- it_splits '37129412345', %w(371 294 123 45)
1044
- end
1045
- describe 'Lebanon' do
1046
- it_splits '9611123456', %w(961 1 123 456)
1047
- it_splits '9614123456', %w(961 4 123 456)
1048
- it_splits '9613123456', %w(961 3 123 456)
1049
- it_splits '96170123456', %w(961 70 123 456)
1050
- it_splits '96190123456', %w(961 90 123 456)
1051
- it_splits '96181123456', %w(961 81 123 456)
1052
- end
1053
- describe 'Lesotho' do
1054
- it_splits '26623592495', ['266', false, '2359', '2495']
1055
- end
1056
- describe 'Liberia' do
1057
- it_splits '23121234567', ['231', false, '2123', '4567']
1058
- it_splits '2314123456', ['231', false, '4123', '456']
1059
- it_splits '231771234567', ['231', false, '77', '123', '4567']
1060
- end
1061
- describe 'Libya' do
1062
- it_splits '21820512345', %w(218 205 123 45)
1063
- it_splits '21822123456', %w(218 22 123 456)
1064
- it_splits '218211234456', %w(218 21 1234 456)
1065
- it_splits '218911234456', %w(218 91 1234 456)
1066
- it_splits '218941234456', %w(218 94 1234 456)
1067
- it_splits '218951234456', %w(218 95 1234 456)
1068
- end
1069
- describe 'Madagascar' do
1070
- it_splits '261202254716', ['261', '20', *%w(22 547 16)]
1071
- it_splits '261320254716', ['261', '32', *%w(02 547 16)]
1072
- it_splits '261330254716', ['261', '33', *%w(02 547 16)]
1073
- it_splits '261340254716', ['261', '34', *%w(02 547 16)]
1074
- end
1075
- describe 'Malawi' do
1076
- it_splits '2651725123', ['265', false, '1725', '123']
1077
- it_splits '265213456789',[ '265', false, '213', '456', '789']
1078
- it_splits '2659123456', ['265', false, '9123', '456']
1079
- it_splits '265991123456', ['265', false, '991', '123', '456']
1080
- end
1081
- describe 'Maldives (Republic of)' do
1082
- it_splits '9606568279', ['960', '656', '8279']
1083
- end
1084
- describe 'Mali' do
1085
- it_splits '22379249349', ['223', false, '7924', '9349']
1086
- end
1087
- describe 'Marshall Islands (Republic of the)' do
1088
- it_splits '6924226536', ['692', false, '422', '6536']
1089
- end
1090
- describe 'Martinique (French Department of)' do
1091
- it_splits '596596123456', %w(596 596 12 34 56)
1092
- end
1093
- describe 'Mauritania' do
1094
- it_splits '22212345678', ['222', false, '1234', '5678']
1095
- end
1096
- describe 'Mauritius' do
1097
- it_splits '23059518919', ['230', false, '5', '951', '8919']
1098
- it_splits '2302600070', ['230', false, '260', '0070']
1099
- end
1100
- describe 'Micronesia (Federated States of)' do
1101
- it_splits '6911991754', ['691', false, '199', '1754']
1102
- end
1103
- describe 'Moldova' do
1104
- it_splits '37380012345', %w(373 800 123 45)
1105
- it_splits '37322123345', %w(373 22 123 345)
1106
- it_splits '37324112345', %w(373 241 123 45)
1107
- it_splits '37360512345', %w(373 605 123 45)
1108
- it_splits '37380312345', %w(373 803 123 45)
1109
- end
1110
- describe 'Mongolia' do
1111
- it_splits '9761112345', %w(976 11 123 45)
1112
- it_splits '9761211234', %w(976 121 12 34)
1113
- it_splits '97612112345', %w(976 121 12 345)
1114
- it_splits '97670123456', %w(976 70 123 456)
1115
- it_splits '97675123456', %w(976 75 123 456)
1116
- it_splits '97688123456', %w(976 88 123 456)
1117
- it_splits '97650123456', %w(976 50 123 456)
1118
- end
1119
- describe 'Mozambique' do
1120
- it_splits '258600123456', %w(258 600 123 456)
1121
- it_splits '25825112345', %w(258 251 123 45)
1122
- it_splits '258821234456', %w(258 82 1234 456)
1123
- it_splits '258712344567', %w(258 7 1234 4567)
1124
- end
1125
- describe 'Namibia' do
1126
- it_splits '264675161324', %w(264 6751 613 24)
1127
- it_splits '26467175890', %w(264 67 175 890)
1128
- it_splits '26463088612345', %w(264 63 088 612 345)
1129
- it_splits '264851234567', %w(264 85 1234 567)
1130
- end
1131
- describe 'Nauru (Republic of)' do
1132
- it_splits '6741288739', ['674', false, '128', '8739']
1133
- end
1134
- describe 'Nepal' do
1135
- it_splits '97714345678', %w(977 1 434 5678)
1136
- it_splits '97710123456', %w(977 10 123 456)
1137
- it_splits '9779812345678', %w(977 98 1234 5678)
1138
- end
1139
- describe "New Caledonia (Territoire français d'outre-mer)" do
1140
- it_splits '687747184', ['687', false, '747', '184']
1141
- end
1142
- describe 'Nicaragua' do
1143
- it_splits '50512345678', ['505', '12', '345', '678']
1144
- end
1145
- describe 'Niger' do
1146
- it_splits '22712345678', ['227', false, '1234', '5678']
1147
- end
1148
- describe 'Nigeria' do
1149
- it_splits '23411231234', %w(234 1 123 1234) # Lagos
1150
-
1151
- it_splits '23445123456', %w(234 45 123 456) # Ogoja
1152
-
1153
- # mobile numbers
1154
- it_splits '2347007661234', %w(234 700 766 1234)
1155
- it_splits '2347017661234', %w(234 701 766 1234)
1156
- it_splits '2347027661234', %w(234 702 766 1234)
1157
- it_splits '2347037661234', %w(234 703 766 1234)
1158
- it_splits '2347047661234', %w(234 704 766 1234)
1159
- it_splits '2347057661234', %w(234 705 766 1234)
1160
- it_splits '2347067661234', %w(234 706 766 1234)
1161
- it_splits '2347077661234', %w(234 707 766 1234)
1162
- it_splits '2347087661234', %w(234 708 766 1234)
1163
- it_splits '2347097661234', %w(234 709 766 1234)
1164
-
1165
- it_splits '2348007661234', %w(234 800 766 1234)
1166
- it_splits '2348017661234', %w(234 801 766 1234)
1167
- it_splits '2348027661234', %w(234 802 766 1234)
1168
- it_splits '2348037661234', %w(234 803 766 1234)
1169
- it_splits '2348047661234', %w(234 804 766 1234)
1170
- it_splits '2348057661234', %w(234 805 766 1234)
1171
- it_splits '2348067661234', %w(234 806 766 1234)
1172
- it_splits '2348077661234', %w(234 807 766 1234)
1173
- it_splits '2348087661234', %w(234 808 766 1234)
1174
- it_splits '2348097661234', %w(234 809 766 1234)
1175
-
1176
- it_splits '2349007661234', %w(234 900 766 1234)
1177
- it_splits '2349017661234', %w(234 901 766 1234)
1178
- it_splits '2349027661234', %w(234 902 766 1234)
1179
- it_splits '2349037661234', %w(234 903 766 1234)
1180
- it_splits '2349047661234', %w(234 904 766 1234)
1181
- it_splits '2349057661234', %w(234 905 766 1234)
1182
- it_splits '2349067661234', %w(234 906 766 1234)
1183
- it_splits '2349077661234', %w(234 907 766 1234)
1184
- it_splits '2349087661234', %w(234 908 766 1234)
1185
- it_splits '2349097661234', %w(234 909 766 1234)
1186
-
1187
- it_splits '2349107661234', %w(234 910 766 1234)
1188
- it_splits '2349117661234', %w(234 911 766 1234)
1189
- it_splits '2349127661234', %w(234 912 766 1234)
1190
- it_splits '2349137661234', %w(234 913 766 1234)
1191
- it_splits '2349147661234', %w(234 914 766 1234)
1192
- it_splits '2349157661234', %w(234 915 766 1234)
1193
- it_splits '2349167661234', %w(234 916 766 1234)
1194
- it_splits '2349177661234', %w(234 917 766 1234)
1195
- it_splits '2349187661234', %w(234 918 766 1234)
1196
- it_splits '2349197661234', %w(234 919 766 1234)
1197
-
1198
- it_splits '2348107661234', %w(234 810 766 1234)
1199
- it_splits '2348117661234', %w(234 811 766 1234)
1200
- it_splits '2348127661234', %w(234 812 766 1234)
1201
- it_splits '2348137661234', %w(234 813 766 1234)
1202
- it_splits '2348147661234', %w(234 814 766 1234)
1203
- it_splits '2348157661234', %w(234 815 766 1234)
1204
- it_splits '2348167661234', %w(234 816 766 1234)
1205
- it_splits '2348177661234', %w(234 817 766 1234)
1206
- it_splits '2348187661234', %w(234 818 766 1234)
1207
- it_splits '2348197661234', %w(234 819 766 1234)
1208
- end
1209
- describe 'Niue' do
1210
- it_splits '6833651', ['683', false, '3651']
1211
- end
1212
- describe 'Palau (Republic of)' do
1213
- it_splits '6804873653', ['680', false, '487', '3653']
1214
- end
1215
- describe 'Panama (Republic of)' do
1216
- it_splits '5078001234', %w(507 800 1234)
1217
- it_splits '50761234567', %w(507 6 123 4567)
1218
- it_splits '5072123456', %w(507 2 123 456)
1219
- end
1220
- describe 'Papua New Guinea' do
1221
- it_splits '6753123567', %w(675 3 123 567)
1222
- it_splits '6751801234', %w(675 180 1234)
1223
- it_splits '67580123456', %w(675 80 123 456)
1224
- it_splits '67591123456', %w(675 91 123 456)
1225
- it_splits '6751612345', %w(675 16 123 45)
1226
- it_splits '67518412345678', %w(675 184 1234 5678)
1227
- it_splits '67517012', %w(675 170 12)
1228
- it_splits '6751891', %w(675 189 1)
1229
- it_splits '6752701234', %w(675 270 1234)
1230
- it_splits '6752751234', %w(675 275 1234)
1231
- it_splits '67527912', %w(675 279 12)
1232
- it_splits '67511512345678', %w(675 115 1234 5678)
1233
- it_splits '67574123456', %w(675 74 123 456)
1234
- it_splits '67573123456', %w(675 731 23 456)
1235
- it_splits '67577301234', %w(675 7730 1 234)
1236
- end
1237
- describe 'Reunion / Mayotte (new)' do
1238
- it_splits '262594399265', ['262', '594', '39', '92', '65']
1239
- end
1240
- describe 'Saint Helena' do
1241
- it_splits '2903614', ['290', false, '3614']
1242
- end
1243
- describe 'Saint Pierre and Miquelon (Collectivité territoriale de la République française)' do
1244
- it_splits '508418826', ['508', false, '418', '826']
1245
- end
1246
- describe 'Samoa (Independent State of)' do
1247
- it_splits '685800123', ['685', false, '800', '123']
1248
- it_splits '68561123', ['685', false, '61', '123']
1249
- it_splits '6857112345', ['685', false, '711', '2345']
1250
- it_splits '6857212345', ['685', false, '721', '2345']
1251
- it_splits '685830123', ['685', false, '830', '123']
1252
- it_splits '685601234', ['685', false, '601', '234']
1253
- it_splits '6858412345', ['685', false, '841', '2345']
1254
- end
1255
- describe 'San Marino' do
1256
- it_splits '378800123', ['378', false, '800', '123']
1257
- it_splits '3788001234567', ['378', false, '800', '123', '4567']
1258
- it_splits '378012345', ['378', false, '012', '345']
1259
- it_splits '3780123456789', ['378', false, '012', '345', '6789']
1260
- it_splits '378512345', ['378', false, '512', '345']
1261
- it_splits '3785123456789', ['378', false, '512', '345', '6789']
1262
- end
1263
- describe 'Saudi Arabia (Kingdom of)' do
1264
- it_splits '9660208528423', %w(966 020 852 8423) # Fixed
1265
- it_splits '966506306201', %w(966 50 630 6201) # NDC Mobile
1266
- it_splits '966112345678', %w(966 11 234 5678) # NDC Region
1267
- it_splits '9668001234567', %w(966 800 123 4567) # Toll Free
1268
- it_splits '966920012345', %w(966 9200 12345) # Univeral Access
1269
- end
1270
- describe 'Senegal' do
1271
- it_splits '221123456789', ['221', false, '1234', '56789']
1272
- end
1273
- describe 'Serbia' do
1274
- it_splits '38180012345', %w(381 800 123 45)
1275
- it_splits '3811012345', %w(381 10 123 45)
1276
- it_splits '38110123456', %w(381 10 123 456)
1277
- it_splits '38111123456', %w(381 11 123 456)
1278
- it_splits '381111234567', %w(381 11 123 4567)
1279
- it_splits '381721234567', %w(381 72 123 4567)
1280
- it_splits '38160123', %w(381 60 123)
1281
- it_splits '381601234567', %w(381 60 123 4567)
1282
- it_splits '38142123456', %w(381 42 123 456)
1283
- it_splits '38191234567', %w(381 9 123 4567)
1284
- it_splits '38160123', %w(381 60 123)
1285
- it_splits '381601234567890', %w(381 60 123 456 7890)
1286
- it_splits '38170123456', %w(381 70 123 456)
1287
- it_splits '38163123456', %w(381 63 123 456)
1288
- end
1289
- describe 'Sierra Leone' do
1290
- it_splits '23264629769', %w(232 64 629 769)
1291
- end
1292
- describe 'Solomon Islands' do
1293
- it_splits '67754692', ['677', false, '54', '692']
1294
- it_splits '6777546921', ['677', false, '7546', '921']
1295
- end
1296
- describe 'Somalia' do
1297
- it_splits '252103412345', %w(252 1034 123 45)
1298
- it_splits '2521313123', %w(252 1313 123)
1299
- it_splits '2521601234', %w(252 160 12 34)
1300
- it_splits '25250012345', %w(252 500 123 45)
1301
- it_splits '252612345678', %w(252 61 234 5678) # Hormuud
1302
- it_splits '252622345678', %w(252 62 234 5678) # Somtel Mogadishu
1303
- it_splits '252634000613', %w(252 63 400 0613) # Telesom
1304
- it_splits '252642345678', %w(252 64 234 5678) # Hormuud
1305
- it_splits '252652345678', %w(252 65 234 5678) # Somtel
1306
- it_splits '252662345678', %w(252 66 234 5678) # Somtel Puntland
1307
- it_splits '252672345678', %w(252 67 234 5678) # Nationlink Mogadishu
1308
- it_splits '252682345678', %w(252 68 234 5678) # Nationlink Mogadishu
1309
- it_splits '252692345678', %w(252 69 234 5678) # Nationlink
1310
- it_splits '252902345678', %w(252 90 234 5678) # Golis
1311
- end
1312
-
1313
- describe 'Suriname (Republic of)' do
1314
- it_splits '597958434', ['597', false, '958', '434']
1315
-
1316
- it_splits '597212345', ['597', false, '212', '345']
1317
- it_splits '5976123456', ['597', false, '612', '3456']
1318
- end
1319
- describe 'Swaziland' do
1320
- it_splits '26822071234', ['268', false, '2207', '1234']
1321
- it_splits '2685501234', ['268', false, '550', '1234']
1322
- end
1323
- describe 'Syrian Arab Republic' do
1324
- it_splits '963111234567', %w(963 11 123 4567)
1325
- it_splits '963311234567', %w(963 31 123 4567)
1326
- it_splits '96315731234', %w(963 15 731 234)
1327
- it_splits '963912345678', %w(963 9 1234 5678)
1328
- end
1329
- describe 'Taiwan' do
1330
- it_splits '886212345678', %w(886 2 1234 5678)
1331
- it_splits '88631234567', %w(886 3 123 4567)
1332
- it_splits '88651234567', %w(886 5 123 4567)
1333
- it_splits '88661234567', %w(886 6 123 4567)
1334
- it_splits '88671234567', %w(886 7 123 4567)
1335
- it_splits '88633123456', %w(886 3 312 3456)
1336
- it_splits '88637123456', %w(886 37 12 3456)
1337
- it_splits '88682712345', %w(886 82 71 2345)
1338
- it_splits '886801123123', %w(886 801 123 123)
1339
- it_splits '88689712345', %w(886 89 71 2345)
1340
- it_splits '88682672345', %w(886 826 7 2345)
1341
- it_splits '88683672345', %w(886 836 7 2345)
1342
- it_splits '88641212345', %w(886 4 121 2345)
1343
- it_splits '886412123456', %w(886 4 1212 3456)
1344
- it_splits '886491234567', %w(886 49 123 4567)
1345
- it_splits '886901234567', %w(886 901 234 567)
1346
- end
1347
- describe 'Togolese Republic' do
1348
- it_splits '22812345678', ['228', false, '1234', '5678']
1349
- end
1350
- describe 'Tajikistan' do
1351
- it_splits '992313012345', %w(992 3130 123 45)
1352
- it_splits '992331700123', %w(992 331700 123)
1353
- it_splits '992372123345', %w(992 372 123 345)
1354
- it_splits '992505123456', %w(992 505 123 456)
1355
- it_splits '992973123456', %w(992 973 123 456)
1356
- it_splits '992474456123', %w(992 474 456 123)
1357
- end
1358
- describe 'Tokelau' do
1359
- it_splits '6901371', %w(690 1 371)
1360
- end
1361
- describe 'Tonga (Kingdom of)' do
1362
- it_splits '67620123', ['676', false, '20', '123']
1363
- it_splits '67684123', ['676', false, '84', '123']
1364
- it_splits '6767712345', ['676', false, '77', '123', '45']
1365
- it_splits '6768912345', ['676', false, '89', '123', '45']
1366
- end
1367
- describe 'Tuvalu' do
1368
- it_splits '68893741', ['688', false, '93741']
1369
- end
1370
- describe 'Turkmenistan' do
1371
- it_splits '99312456789', %w(993 12 456 789)
1372
- it_splits '99313145678', %w(993 131 456 78)
1373
- it_splits '99313924567', %w(993 1392 4567)
1374
- it_splits '99361234567', %w(993 6 123 4567)
1375
- end
1376
- describe 'Ukraine' do
1377
- it_splits '380800123456', %w(380 800 123 456)
1378
- it_splits '380312123456', %w(380 312 123 456)
1379
- it_splits '380320123456', %w(380 32 0123 456)
1380
- it_splits '380325912345', %w(380 3259 123 45)
1381
- it_splits '380326061234', %w(380 32606 1234)
1382
- it_splits '380391234567', %w(380 39 123 45 67)
1383
- it_splits '380501234567', %w(380 50 123 45 67)
1384
- it_splits '380631234567', %w(380 63 123 45 67)
1385
- it_splits '380661234567', %w(380 66 123 45 67)
1386
- it_splits '380671234567', %w(380 67 123 45 67)
1387
- it_splits '380681234567', %w(380 68 123 45 67)
1388
- it_splits '380911234567', %w(380 91 123 45 67)
1389
- it_splits '380921234567', %w(380 92 123 45 67)
1390
- it_splits '380931234567', %w(380 93 123 45 67)
1391
- it_splits '380731234567', %w(380 73 123 45 67)
1392
- it_splits '380941234567', %w(380 94 123 45 67)
1393
- it_splits '380951234567', %w(380 95 123 45 67)
1394
- it_splits '380961234567', %w(380 96 123 45 67)
1395
- it_splits '380971234567', %w(380 97 123 45 67)
1396
- it_splits '380981234567', %w(380 98 123 45 67)
1397
- it_splits '380991234567', %w(380 99 123 45 67)
1398
- end
1399
- describe 'United Arab Emirates' do
1400
- it_splits '97180012', %w(971 800 12)
1401
- it_splits '971800123456789', %w(971 800 12 345 6789)
1402
- it_splits '97180012345678', %w(971 800 12 345 678)
1403
- it_splits '9718001234567', %w(971 800 12 345 67)
1404
- it_splits '97121234567', %w(971 2 123 4567)
1405
- it_splits '971506412345', %w(971 50 641 2345)
1406
- it_splits '971600641234', %w(971 600 641 234)
1407
- it_splits '971500641234', %w(971 500 641 234)
1408
- it_splits '971200641234', %w(971 200 641 234)
1409
- it_splits '971549999999', %w(971 54 999 9999)
1410
- it_splits '971589999999', %w(971 58 999 9999)
1411
- end
1412
- describe 'Uruguay (Eastern Republic of)' do
1413
- it_splits '59880012345', %w(598 800 123 45)
1414
- it_splits '59820123456', %w(598 2 012 3456)
1415
- it_splits '59821123456', %w(598 21 123 456)
1416
- it_splits '59890912345', %w(598 909 123 45)
1417
- it_splits '59893123456', %w(598 93 123 456)
1418
- it_splits '59890812345', %w(598 908 123 45)
1419
- it_splits '59880512345', %w(598 805 123 45)
1420
- end
1421
- describe 'Uzbekistan (Republic of)' do
1422
- it_splits '998433527869', %w(998 43 352 7869)
1423
- end
1424
- describe 'Vanuatu (Republic of)' do
1425
- it_splits '67889683', ['678', false, '89', '683']
1426
- end
1427
- describe 'Yemen' do
1428
- it_splits '9671234567', %w(967 1 234 567)
1429
- it_splits '96712345678', %w(967 1 234 5678)
1430
- it_splits '9677234567', %w(967 7 234 567)
1431
- it_splits '967771234567', %w(967 77 123 4567)
1432
- it_splits '967581234', %w(967 58 1234)
1433
- end
1434
- describe 'Zimbabwe' do
1435
- it_splits '2632582123456', %w(263 2582 123 456)
1436
- it_splits '2632582123', %w(263 2582 123)
1437
- it_splits '263147123456', %w(263 147 123 456)
1438
- it_splits '263147123', %w(263 147 123)
1439
- it_splits '263270123456', %w(263 270 123 456)
1440
- it_splits '26327012345', %w(263 270 123 45)
1441
- it_splits '2638612354567', %w(263 86 1235 4567)
1442
-
1443
- # mobile numbers (see http://www.itu.int/dms_pub/itu-t/oth/02/02/T02020000E90002PDFE.pdf, Table 4, Page 25)
1444
- %w(71 73 77 78).each do |prefix|
1445
- number = "263#{prefix}2345678"
1446
- it_splits number, ['263', prefix, '234', '5678']
1447
- end
1448
- end
1449
-
1450
- describe 'Universal International Freephone' do
1451
- it_splits '80012345678', ['800', false, '12345678']
1452
- end
1453
-
1454
- describe 'Shared-Cost Service' do
1455
- it_splits '80812345678', ['808', false, '12345678']
1456
- end
1457
- end
1458
-
1459
- end