phony 2.18.3 → 3.0.3

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