superp-phone 1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,9 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
2
+
3
+ ## Bosnia and Herzegovina
4
+ class BATest < Phoner::TestCase
5
+ def test_local
6
+ parse_test('+387 33 25 02 33', '387', '33', '250233', "Bosnia and Herzegovina", false)
7
+ parse_test('+387 61 25 02 33', '387', '6', '1250233', "Bosnia and Herzegovina", true)
8
+ end
9
+ end
@@ -0,0 +1,120 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
2
+
3
+ ## Belgium
4
+ class BETest < Phoner::TestCase
5
+
6
+ def test_mobile
7
+ parse_test('+32 4 12345678', '32', '4', '12345678', 'Belgium', true)
8
+ end
9
+
10
+ ## single digit
11
+ # 02: Brussels (Bruxelles/Brussel)
12
+ def test_brussels
13
+ parse_test('+32 2 1234567', '32', '2', '1234567', 'Belgium', false)
14
+ end
15
+ # 03: Antwerpen (Antwerp), Sint-Niklaas
16
+ def test_antwerpen
17
+ parse_test('+32 3 1234567', '32', '3', '1234567')
18
+ end
19
+ # 04: Liège (Luik), Voeren (Fourons)
20
+ def test_liege
21
+ parse_test('+32 4 1234567', '32', '4', '1234567', 'Belgium', false)
22
+ end
23
+ # 09: Gent (Ghent/Gand)
24
+ def test_gent
25
+ parse_test('+32 9 1234567', '32', '9', '1234567')
26
+ end
27
+
28
+ ## two digit
29
+ # 010: Wavre (Waver)
30
+ def test_wavre
31
+ parse_test('+32 10 123456', '32', '10', '123456')
32
+ end
33
+ # 011: Hasselt
34
+ def test_hasselt
35
+ parse_test('+32 11 123456', '32', '11', '123456')
36
+ end
37
+ # 012: Tongeren (Tongres)
38
+ def test_tongeren
39
+ parse_test('+32 12 123456', '32', '12', '123456')
40
+ end
41
+ # 013: Diest
42
+ def test_diest
43
+ parse_test('+32 13 123456', '32', '13', '123456')
44
+ end
45
+ # 014: Herentals, Turnhout
46
+ # 015: Mechelen (Malines)
47
+ # 016: Leuven (Louvain), Tienen (Tirlemont)
48
+ # 019: Waremme (Borgworm)
49
+ def test_waremme
50
+ parse_test('+32 19 123456', '32', '19', '123456')
51
+ end
52
+
53
+ # 050: Brugge (Bruges), Zeebrugge
54
+ def test_brugge
55
+ parse_test('+32 50 123456', '32', '50', '123456')
56
+ end
57
+ # 051: Roeselare (Roulers)
58
+ def test_roeselare
59
+ parse_test('+32 51 123456', '32', '51', '123456')
60
+ end
61
+ # 052: Dendermonde (Termonde)
62
+ # 053: Aalst (Alost)
63
+ # 054: Ninove
64
+ # 055: Ronse (Renaix)
65
+ # 056: Kortrijk (Courtrai), Comines-Warneton, Mouscron (Moeskroen)
66
+ # 057: Ieper (Ypres)
67
+ # 058: Veurne (Furnes)
68
+ # 059: Oostende (Ostend)
69
+ def test_oostende
70
+ parse_test('+32 59 123456', '32', '59', '123456')
71
+ end
72
+
73
+ # 060: Chimay
74
+ def test_chimay
75
+ parse_test('+32 60 123456', '32', '60', '123456')
76
+ end
77
+ # 061: Bastogne, Libramont-Chevigny
78
+ # 063: Arlon (Aarlen)
79
+ # 064: La Louviere
80
+ # 065: Mons (Bergen)
81
+ # 067: Nivelles (Nijvel)
82
+ def test_nivelles
83
+ parse_test('+32 67 123456', '32', '67', '123456')
84
+ end
85
+ # 068: Ath (Aat)
86
+ # 069: Tournai (Doornik)
87
+
88
+ # 070: Specialty Numbers (i.e. bus information or bank information)
89
+ def test_specialty
90
+ parse_test('+32 70 123456', '32', '70', '123456')
91
+ end
92
+ # 071: Charleroi
93
+
94
+ # 081: Namur (Namen)
95
+ def test_namur
96
+ parse_test('+32 81 123456', '32', '81', '123456')
97
+ end
98
+ # 082: Dinant
99
+ # 083: Ciney
100
+ # 084: Jemelle, Marche-en-Famenne
101
+ # 085: Huy
102
+ # 086: Durbuy
103
+ # 087: Verviers
104
+ # 089: Genk
105
+
106
+ # 0800: toll free service
107
+ def test_toll_free
108
+ parse_test('+32 800 12345', '32', '800', '12345')
109
+ end
110
+
111
+ # 090x: Premium numbers (0900, 0901, 0902, 0903, 0904, 0905, 0906, 0907, 0908, 0909)
112
+ def test_premium_900
113
+ parse_test('+32 900 12345', '32', '900', '12345')
114
+ end
115
+
116
+ def test_premium_901
117
+ parse_test('+32 901 12345', '32', '901', '12345')
118
+ end
119
+
120
+ end
@@ -0,0 +1,20 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
2
+
3
+ ## Canada
4
+ class CATest < Phoner::TestCase
5
+
6
+ def test_local
7
+ parse_test('+1 416 856 3348', '1', '416', '8563348', 'Canada')
8
+ end
9
+
10
+ def test_long_with_default_country_code
11
+ Phoner::Phone.default_country_code = '1'
12
+ parse_test('9059735100', '1', '905', '9735100', 'Canada')
13
+ end
14
+
15
+ def test_short_with_default_country_code_and_area_code
16
+ Phoner::Phone.default_country_code = '1'
17
+ Phoner::Phone.default_area_code = '416'
18
+ parse_test('9735100', '1', '416', '9735100', 'Canada')
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
2
+
3
+ ## Germany
4
+ class DETest < Phoner::TestCase
5
+
6
+ def test_local
7
+ parse_test('+49 714 1605832', '49', '714', '1605832', "Germany", false)
8
+ end
9
+
10
+ def test_mobile
11
+ parse_test('+49 162 3499558', '49', '162', '3499558', "Germany", true)
12
+ end
13
+
14
+ def test_country_side
15
+ parse_test('+49 (0)6120 59511-23', '49', '6120', '5951123', "Germany", false)
16
+ end
17
+
18
+ end
@@ -0,0 +1,22 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
2
+
3
+ ## France
4
+ class FRTest < Phoner::TestCase
5
+
6
+ def test_local
7
+ parse_test('+33 4 75 06 07 07', '33', '4', '75060707', "France", false)
8
+ end
9
+
10
+ def test_mobile
11
+ parse_test('+33 6 11 22 33 44', '33', '6', '11223344', "France", true)
12
+ end
13
+
14
+ def test_mobile_07
15
+ parse_test('+33 7 11 22 33 44', '33', '7', '11223344', "France", true)
16
+ end
17
+
18
+ def test_voip
19
+ parse_test('+33 9 11 22 33 44', '33', '9', '11223344', "France", false)
20
+ end
21
+
22
+ end
@@ -0,0 +1,262 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
2
+
3
+ # http://stakeholders.ofcom.org.uk/telecoms/numbering/guidance-tele-no/numbers-for-drama
4
+ #
5
+ # Geographic Area Geographic Area Code Telephone Number Range
6
+ # (1000 numbers in each range)
7
+ # Leeds 0113 496 0000 to 496 0999
8
+ # Sheffield 0114 496 0000 to 496 0999
9
+ # Nottingham 0115 496 0000 to 496 0999
10
+ # Leicester 0116 496 0000 to 496 0999
11
+ # Bristol 0117 496 0000 to 496 0999
12
+ # Reading 0118 496 0000 to 496 0999
13
+ # Birmingham 0121 496 0000 to 496 0999
14
+ # Edinburgh 0131 496 0000 to 496 0999
15
+ # Glasgow 0141 496 0000 to 496 0999
16
+ # Liverpool 0151 496 0000 to 496 0999
17
+ # Manchester 0161 496 0000 to 496 0999
18
+ # London 020 7946 0000 to 7946 0999
19
+ # Tyneside/Durham
20
+ #/Sunderland 0191 498 0000 to 498 0999
21
+ # Northern Ireland 028 9018 0000 to 9018 0999
22
+ # Cardiff 029 2018 0000 to 2018 0999
23
+ # No area 01632 960000 to 960999
24
+ #
25
+ # Other Telephone Numbers
26
+ #
27
+ # Telephone Number Type Telephone Number Range
28
+ # (1000 numbers in each range)
29
+ # Mobile 07700 900000 to 900999
30
+ # Freephone 08081 570000 to 570999
31
+ # Premium Rate Services 0909 8790000 to 8790999
32
+ # UK Wide 03069 990000 to 990999
33
+
34
+ class GBTest < Phoner::TestCase
35
+
36
+ ## SHORT CODES
37
+ # London 020 7946 0000 to 7946 0999
38
+ def test_london
39
+ parse_test('+44 20 7946 0123', '44', '20', '79460123')
40
+ end
41
+
42
+ # Northern Ireland 028 9018 0000 to 9018 0999
43
+ def test_northern_ireland
44
+ parse_test('+44 28 9018 0123', '44', '28', '90180123')
45
+ end
46
+
47
+ # Cardiff 029 2018 0000 to 2018 0999
48
+ def test_cardiff
49
+ parse_test('+44 29 2018 0123', '44', '29', '20180123')
50
+ end
51
+
52
+ # Leeds 0113 496 0000 to 496 0999
53
+ def test_leeds
54
+ parse_test('+44 113 496 0123', '44', '113', '4960123')
55
+ end
56
+
57
+ # Sheffield 0114 496 0000 to 496 0999
58
+ def test_sheffield
59
+ parse_test('+44 114 496 0123', '44', '114', '4960123')
60
+ end
61
+
62
+ # Nottingham 0115 496 0000 to 496 0999
63
+ def test_nottingham
64
+ parse_test('+44 115 496 0123', '44', '115', '4960123')
65
+ end
66
+
67
+ # Leicester 0116 496 0000 to 496 0999
68
+ def test_leicester
69
+ parse_test('+44 116 496 0123', '44', '116', '4960123')
70
+ end
71
+
72
+ # Bristol 0117 496 0000 to 496 0999
73
+ def test_bristol
74
+ parse_test('+44 117 496 0123', '44', '117', '4960123')
75
+ end
76
+
77
+ # Reading 0118 496 0000 to 496 0999
78
+ def test_reading
79
+ parse_test('+44 118 496 0123', '44', '118', '4960123')
80
+ end
81
+
82
+ # Birmingham 0121 496 0000 to 496 0999
83
+ def test_birmingham
84
+ parse_test('+44 121 496 0123', '44', '121', '4960123')
85
+ end
86
+
87
+ # Edinburgh 0131 496 0000 to 496 0999
88
+ def test_edinburgh
89
+ parse_test('+44 131 496 0123', '44', '131', '4960123')
90
+ end
91
+
92
+ # Glasgow 0141 496 0000 to 496 0999
93
+ def test_glasgow
94
+ parse_test('+44 141 496 0123', '44', '141', '4960123')
95
+ end
96
+
97
+ # Liverpool 0151 496 0000 to 496 0999
98
+ def test_liverpool
99
+ parse_test('+44 151 496 0123', '44', '151', '4960123')
100
+ end
101
+
102
+ # Manchester 0161 496 0000 to 496 0999
103
+ def test_manchester
104
+ parse_test('+44 161 496 0123', '44', '161', '4960123')
105
+ end
106
+
107
+ # Tyneside/Durham
108
+ #/Sunderland 0191 498 0000 to 498 0999
109
+ def test_tyneside
110
+ parse_test('+44 191 496 0123', '44', '191', '4960123')
111
+ end
112
+
113
+ ## LONG CODES
114
+
115
+ # 01202 — Bournemouth (BO)
116
+ def test_bournemouth
117
+ parse_test('+44 1202 96 0123', '44', '1202', '960123')
118
+ end
119
+
120
+ # 01326 — Falmouth (FA)
121
+ def test_falmouth
122
+ parse_test('+44 1326 96 0123', '44', '1326', '960123')
123
+ end
124
+
125
+ # 01420 — Alton (HA)
126
+ def test_alton
127
+ parse_test('+44 1420 96 0123', '44', '1420', '960123')
128
+ end
129
+
130
+ # 01598 — Lynton (LY)
131
+ def test_lynton
132
+ parse_test('+44 1598 96 0123', '44', '1598', '960123')
133
+ end
134
+
135
+ # 01637 — Newquay (NE)
136
+ def test_newquay
137
+ parse_test('+44 1637 96 0123', '44', '1637', '960123')
138
+ end
139
+
140
+ # 01700 — Rothesay (RO)
141
+ def test_rothesay
142
+ parse_test('+44 1700 96 0123', '44', '1700', '960123')
143
+ end
144
+
145
+ # 01951 — Colonsay
146
+ def test_colonsay
147
+ parse_test('+44 1951 96 0123', '44', '1951', '960123')
148
+ end
149
+
150
+ # No area 01632 960000 to 960999
151
+ def test_no_area
152
+ parse_test('+44 1632 96 0123', '44', '1632', '960123')
153
+ end
154
+
155
+ # Personal numbering 070 xxxx xxxx
156
+ def test_personal_numbering
157
+ parse_test('+44 70 00001234', '44', '70', '00001234')
158
+ end
159
+
160
+ # Mobile 07700 900000 to 900999
161
+ def test_mobile
162
+ parse_test('+44 7700 900345', '44', '7700', '900345', "United Kingdom", true)
163
+ end
164
+
165
+ def test_mobile_2
166
+ parse_test('+44 7778 900345', '44', '7778', '900345')
167
+ end
168
+
169
+ # Freephone 08081 570000 to 570999
170
+ def test_freephone
171
+ parse_test('+44 808 1570123', '44', '808', '1570123', "United Kingdom", false)
172
+ end
173
+
174
+ # Premium Rate Services 0909 8790000 to 8790999
175
+ def test_premium_service_1
176
+ parse_test('+44 909 8790999', '44', '909', '8790999')
177
+ end
178
+
179
+ def test_premium_service_2
180
+ parse_test('+44 910 8790123', '44', '910', '8790123')
181
+ end
182
+
183
+ # UK Wide 03069 990000 to 990999
184
+ def test_wide
185
+ parse_test('+44 306 9990123', '44', '306', '9990123')
186
+ end
187
+
188
+ def test_wide_2
189
+ parse_test('+44 339 9990123', '44', '339', '9990123')
190
+ end
191
+
192
+ # Tests for additional number ranges not previously mentioned
193
+
194
+ def test_four_plus_five_1
195
+ parse_test('+44 1204 62532', '44', '1204', '62532')
196
+ end
197
+
198
+ def test_four_plus_five_2
199
+ parse_test('+44 1946 62888', '44', '1946', '62888')
200
+ end
201
+
202
+ def test_five_plus_five_1
203
+ parse_test('+44 15396 48788', '44', '15396', '48788')
204
+ end
205
+
206
+ def test_five_plus_five_2
207
+ parse_test('+44 16973 88555', '44', '16973', '88555')
208
+ end
209
+
210
+ def test_five_plus_five_3
211
+ parse_test('+44 16977 44888', '44', '16977', '44888')
212
+ end
213
+
214
+ def test_five_plus_five_4
215
+ parse_test('+44 19467 22444', '44', '19467', '22444')
216
+ end
217
+
218
+ def test_five_plus_four_1
219
+ parse_test('+44 16977 3555', '44', '16977', '3555')
220
+ end
221
+
222
+ def test_four_plus_six_1
223
+ parse_test('+44 1539 248756', '44', '1539', '248756')
224
+ end
225
+
226
+ def test_four_plus_six_2
227
+ parse_test('+44 1697 222555', '44', '1697', '222555')
228
+ end
229
+
230
+ def test_four_plus_six_3
231
+ parse_test('+44 1946 555777', '44', '1946', '555777')
232
+ end
233
+
234
+ def test_three_plus_six_1
235
+ parse_test('+44 500 777888', '44', '500', '777888')
236
+ end
237
+
238
+ def test_three_plus_six_2
239
+ parse_test('+44 800 555777', '44', '800', '555777')
240
+ end
241
+
242
+ def test_three_plus_seven_1
243
+ parse_test('+44 800 3337788', '44', '800', '3337788')
244
+ end
245
+
246
+ def test_voip
247
+ parse_test('+44 56 4477 5533', '44', '56', '44775533')
248
+ end
249
+
250
+ def test_corporate
251
+ parse_test('+44 55 7567 1113', '44', '55', '75671113')
252
+ end
253
+
254
+ def test_business_rate
255
+ parse_test('+44 843 5389123', '44', '843', '5389123')
256
+ end
257
+
258
+ def test_premium
259
+ parse_test('+44 873 1570123', '44', '873', '1570123')
260
+ end
261
+
262
+ end