phony 1.9.0 → 2.19.14

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