icu_utils 1.0.1 → 1.1.0

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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- icu_utils (1.0.1)
4
+ icu_utils (1.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -162,7 +162,7 @@ module ICU
162
162
  ['BAR', 'Barbados'],
163
163
  ['BLR', 'Belarus'],
164
164
  ['BEL', 'Belgium'],
165
- ['BLZ', 'Belize'],
165
+ ['BIZ', 'Belize'],
166
166
  ['BEN', 'Benin Republic'],
167
167
  ['BER', 'Bermuda'],
168
168
  ['BHU', 'Bhutan'],
@@ -235,7 +235,7 @@ module ICU
235
235
  ['LAO', 'Laos'],
236
236
  ['LAT', 'Latvia'],
237
237
  ['LIB', 'Lebanon'],
238
- ['LSO', 'Lesotho'],
238
+ ['LES', 'Lesotho'],
239
239
  ['LBA', 'Libya'],
240
240
  ['LIE', 'Liechtenstein'],
241
241
  ['LTU', 'Lithuania'],
@@ -248,7 +248,7 @@ module ICU
248
248
  ['MDV', 'Maldives'],
249
249
  ['MLI', 'Mali'],
250
250
  ['MLT', 'Malta'],
251
- ['MAU', 'Mauritania'],
251
+ ['MTN', 'Mauritania'],
252
252
  ['MRI', 'Mauritius'],
253
253
  ['MEX', 'Mexico'],
254
254
  ['MDA', 'Moldova'],
@@ -283,11 +283,12 @@ module ICU
283
283
  ['RWA', 'Rwanda'],
284
284
  ['SMR', 'San Marino'],
285
285
  ['STP', 'Sao Tome and Principe'],
286
+ ['KSA', 'Saudi Arabia'],
286
287
  ['SCO', 'Scotland'],
287
288
  ['SEN', 'Senegal'],
288
289
  ['SRB', 'Serbia'],
289
290
  ['SEY', 'Seychelles'],
290
- ['SLE', 'Siera Leone'],
291
+ ['SLE', 'Sierra Leone'],
291
292
  ['SIN', 'Singapore'],
292
293
  ['SVK', 'Slovakia'],
293
294
  ['SLO', 'Slovenia'],
@@ -299,6 +300,7 @@ module ICU
299
300
  ['SRI', 'Sri Lanka'],
300
301
  ['SUD', 'Sudan'],
301
302
  ['SUR', 'Surinam'],
303
+ ['SWZ', 'Swaziland'],
302
304
  ['SWE', 'Sweden'],
303
305
  ['SUI', 'Switzerland'],
304
306
  ['SYR', 'Syria'],
@@ -1,3 +1,3 @@
1
1
  module IcuUtils
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  module ICU
4
4
  describe Federation do
5
- let(:total) { 179 }
5
+ let(:total) { 181 }
6
6
 
7
7
  context "#find using codes" do
8
8
  it "should find a federation given a valid code" do
@@ -188,5 +188,253 @@ module ICU
188
188
  all.index('INA,IND,IRI,IRL,IRQ,ISL,ISR,ISV,ITA,IVB').should_not be_nil
189
189
  end
190
190
  end
191
+
192
+ context "IOC codes" do
193
+ before(:all) do
194
+ ioc_and_fide = # from http://en.wikipedia.org/wiki/List_of_IOC_country_codes in November 2013
195
+ {
196
+ "AFG" => "Afghanistan",
197
+ "AHO" => "Netherlands Antilles",
198
+ "ALB" => "Albania",
199
+ "ALG" => "Algeria",
200
+ "AND" => "Andorra",
201
+ "ANG" => "Angola",
202
+ "ANT" => "Antigua and Barbuda",
203
+ "ARG" => "Argentina",
204
+ "ARM" => "Armenia",
205
+ "ARU" => "Aruba",
206
+ "AUS" => "Australia",
207
+ "AUT" => "Austria",
208
+ "AZE" => "Azerbaijan",
209
+ "BAH" => "Bahamas",
210
+ "BAN" => "Bangladesh",
211
+ "BAR" => "Barbados",
212
+ "BDI" => "Burundi",
213
+ "BEL" => "Belgium",
214
+ "BEN" => "Benin",
215
+ "BER" => "Bermuda",
216
+ "BHU" => "Bhutan",
217
+ "BIH" => "Bosnia and Herzegovina",
218
+ "BIZ" => "Belize",
219
+ "BLR" => "Belarus",
220
+ "BOL" => "Bolivia",
221
+ "BOT" => "Botswana",
222
+ "BRA" => "Brazil",
223
+ "BRN" => "Bahrain",
224
+ "BRU" => "Brunei",
225
+ "BUL" => "Bulgaria",
226
+ "CAM" => "Cambodia",
227
+ "CAN" => "Canada",
228
+ "CGO" => "Congo",
229
+ "CHA" => "Chad",
230
+ "CHI" => "Chile",
231
+ "CHN" => "China",
232
+ "CIV" => "Ivory Coast",
233
+ "CMR" => "Cameroon",
234
+ "COL" => "Colombia",
235
+ "CRC" => "Costa Rica",
236
+ "CRO" => "Croatia",
237
+ "CUB" => "Cuba",
238
+ "CYP" => "Cyprus",
239
+ "CZE" => "Czech Republic",
240
+ "DEN" => "Denmark",
241
+ "DJI" => "Djibouti",
242
+ "DOM" => "Dominican Republic",
243
+ "ECU" => "Ecuador",
244
+ "EGY" => "Egypt",
245
+ "ESA" => "El Salvador",
246
+ "ESP" => "Spain",
247
+ "EST" => "Estonia",
248
+ "ETH" => "Ethiopia",
249
+ "FIJ" => "Fiji",
250
+ "FIN" => "Finland",
251
+ "FRA" => "France",
252
+ "FRO" => "Faroe Islands",
253
+ "GAB" => "Gabon",
254
+ "GAM" => "The Gambia",
255
+ "GEO" => "Georgia",
256
+ "GER" => "Germany",
257
+ "GHA" => "Ghana",
258
+ "GRE" => "Greece",
259
+ "GUA" => "Guatemala",
260
+ "GUM" => "Guam",
261
+ "GUY" => "Guyana",
262
+ "HAI" => "Haiti",
263
+ "HKG" => "Hong Kong",
264
+ "HON" => "Honduras",
265
+ "HUN" => "Hungary",
266
+ "INA" => "Indonesia",
267
+ "IND" => "India",
268
+ "IRI" => "Iran",
269
+ "IRL" => "Ireland",
270
+ "IRQ" => "Iraq",
271
+ "ISL" => "Iceland",
272
+ "ISR" => "Israel",
273
+ "ISV" => "Virgin Islands",
274
+ "ITA" => "Italy",
275
+ "IVB" => "British Virgin Islands",
276
+ "JAM" => "Jamaica",
277
+ "JOR" => "Jordan",
278
+ "JPN" => "Japan",
279
+ "KAZ" => "Kazakhstan",
280
+ "KEN" => "Kenya",
281
+ "KGZ" => "Kyrgyzstan",
282
+ "KOR" => "South Korea",
283
+ "KSA" => "Saudi Arabia",
284
+ "KUW" => "Kuwait",
285
+ "LAO" => "Laos",
286
+ "LAT" => "Latvia",
287
+ "LBA" => "Libya",
288
+ "LES" => "Lesotho",
289
+ "LIB" => "Lebanon",
290
+ "LIE" => "Liechtenstein",
291
+ "LTU" => "Lithuania",
292
+ "LUX" => "Luxembourg",
293
+ "MAC" => "Macau",
294
+ "MAD" => "Madagascar",
295
+ "MAR" => "Morocco",
296
+ "MAS" => "Malaysia",
297
+ "MAW" => "Malawi",
298
+ "MDA" => "Moldova",
299
+ "MDV" => "Maldives",
300
+ "MEX" => "Mexico",
301
+ "MGL" => "Mongolia",
302
+ "MKD" => "Macedonia",
303
+ "MLI" => "Mali",
304
+ "MLT" => "Malta",
305
+ "MNE" => "Montenegro",
306
+ "MON" => "Monaco",
307
+ "MOZ" => "Mozambique",
308
+ "MRI" => "Mauritius",
309
+ "MTN" => "Mauritania",
310
+ "MYA" => "Myanmar",
311
+ "NAM" => "Namibia",
312
+ "NCA" => "Nicaragua",
313
+ "NED" => "Netherlands",
314
+ "NEP" => "Nepal",
315
+ "NGR" => "Nigeria",
316
+ "NOR" => "Norway",
317
+ "NZL" => "New Zealand",
318
+ "PAK" => "Pakistan",
319
+ "PAN" => "Panama",
320
+ "PAR" => "Paraguay",
321
+ "PER" => "Peru",
322
+ "PHI" => "Philippines",
323
+ "PLE" => "Palestine",
324
+ "PLW" => "Palau",
325
+ "PNG" => "Papua New Guinea",
326
+ "POL" => "Poland",
327
+ "POR" => "Portugal",
328
+ "PUR" => "Puerto Rico",
329
+ "QAT" => "Qatar",
330
+ "ROU" => "Romania",
331
+ "RSA" => "South Africa",
332
+ "RUS" => "Russia",
333
+ "RWA" => "Rwanda",
334
+ "SEN" => "Senegal",
335
+ "SEY" => "Seychelles",
336
+ "SIN" => "Singapore",
337
+ "SLE" => "Sierra Leone",
338
+ "SLO" => "Slovenia",
339
+ "SMR" => "San Marino",
340
+ "SOL" => "Solomon Islands",
341
+ "SOM" => "Somalia",
342
+ "SRB" => "Serbia",
343
+ "SRI" => "Sri Lanka",
344
+ "STP" => "Sao Tome and Principe",
345
+ "SUD" => "Sudan",
346
+ "SUI" => "Switzerland",
347
+ "SUR" => "Suriname",
348
+ "SVK" => "Slovakia",
349
+ "SWE" => "Sweden",
350
+ "SWZ" => "Swaziland",
351
+ "SYR" => "Syria",
352
+ "TAN" => "Tanzania",
353
+ "THA" => "Thailand",
354
+ "TJK" => "Tajikistan",
355
+ "TKM" => "Turkmenistan",
356
+ "TOG" => "Togo",
357
+ "TPE" => "Chinese Taipei",
358
+ "TRI" => "Trinidad and Tobago",
359
+ "TUN" => "Tunisia",
360
+ "TUR" => "Turkey",
361
+ "UAE" => "United Arab Emirates",
362
+ "UGA" => "Uganda",
363
+ "UKR" => "Ukraine",
364
+ "URU" => "Uruguay",
365
+ "USA" => "United States",
366
+ "UZB" => "Uzbekistan",
367
+ "VEN" => "Venezuela",
368
+ "VIE" => "Vietnam",
369
+ "YEM" => "Yemen",
370
+ "ZAM" => "Zambia",
371
+ "ZIM" => "Zimbabwe",
372
+ }
373
+ ioc_but_not_fide =
374
+ {
375
+ "ASA" => "American Samoa",
376
+ "BUR" => "Burkina Faso",
377
+ "CAF" => "Central African Republic",
378
+ "CAY" => "Cayman Islands",
379
+ "COD" => "DR Congo",
380
+ "COK" => "Cook Islands",
381
+ "COM" => "Comoros",
382
+ "CPV" => "Cape Verde",
383
+ "DMA" => "Dominica",
384
+ "ERI" => "Eritrea",
385
+ "FSM" => "Federated States of Micronesia",
386
+ "GBR" => "Great Britain",
387
+ "GBS" => "Guinea-Bissau",
388
+ "GEQ" => "Equatorial Guinea",
389
+ "GRN" => "Grenada",
390
+ "GUI" => "Guinea",
391
+ "KIR" => "Kiribati",
392
+ "LBR" => "Liberia",
393
+ "LCA" => "Saint Lucia",
394
+ "MHL" => "Marshall Islands",
395
+ "NIG" => "Niger",
396
+ "NRU" => "Nauru",
397
+ "OMA" => "Oman",
398
+ "PRK" => "North Korea",
399
+ "SAM" => "Samoa",
400
+ "SKN" => "Saint Kitts and Nevis",
401
+ "TGA" => "Tonga",
402
+ "TLS" => "Timor-Leste",
403
+ "TUV" => "Tuvalu",
404
+ "VAN" => "Vanuatu",
405
+ "VIN" => "Saint Vincent and the Grenadines",
406
+ }
407
+ @missing = []
408
+ @badname = []
409
+ british = %w[ENG SCO WLS GCI JCI]
410
+ exceptions = # FIDE => IOC
411
+ {
412
+ "FAI" => "FRO", # Faroe Islands
413
+ "MNC" => "MON", # Monaco
414
+ }
415
+ got = {}
416
+ Federation.menu.each do |name, code|
417
+ if ioc_and_fide[code]
418
+ @badname << "#{code} #{name} #{ioc_and_fide[code]}" unless ioc_and_fide[code].include?(name) || name.include?(ioc_and_fide[code])
419
+ else
420
+ @missing << code unless british.include?(code) || exceptions.keys.include?(code)
421
+ end
422
+ got[code] = true
423
+ end
424
+ @not_included = ioc_and_fide.keys.reject { |code| got[code] || exceptions.values.include?(code) }
425
+ end
426
+
427
+ it "codes should be all IOC with some exceptions" do
428
+ expect(@missing.join("|")).to eq ""
429
+ end
430
+
431
+ it "country names should be similar to the IOC name" do
432
+ expect(@badname.join("|")).to eq ""
433
+ end
434
+
435
+ it "all IOC codes that are FIDE members should be present" do
436
+ expect(@not_included.join("|")).to eq ""
437
+ end
438
+ end
191
439
  end
192
440
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: icu_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-02 00:00:00.000000000 Z
12
+ date: 2013-11-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -118,7 +118,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  segments:
120
120
  - 0
121
- hash: -748731329100814069
121
+ hash: -2508500886105077013
122
122
  required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  none: false
124
124
  requirements:
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
127
  version: '0'
128
128
  segments:
129
129
  - 0
130
- hash: -748731329100814069
130
+ hash: -2508500886105077013
131
131
  requirements: []
132
132
  rubyforge_project:
133
133
  rubygems_version: 1.8.23