tests/testthat/test-names-external.R

context('External validity of country names')

name_of <- function(iso3c) countrycode(iso3c, 'iso3c', 'country.name', warn = TRUE)

test_that('a variety of country names yield correct iso3c codes', {
    expect_that(name_of('ABW'), equals('Aruba'))
    expect_that(name_of('AFG'), equals('Afghanistan'))
    expect_that(name_of('AGO'), equals('Angola'))
    expect_that(name_of('AIA'), equals('Anguilla'))
    expect_that(name_of('ALA'), equals('Aland Islands'))
    expect_that(name_of('ALB'), equals('Albania'))
    expect_that(name_of('AND'), equals('Andorra'))
    expect_that(name_of('ARE'), equals('United Arab Emirates'))
    expect_that(name_of('ARG'), equals('Argentina'))
    expect_that(name_of('ARM'), equals('Armenia'))
    expect_that(name_of('ASM'), equals('American Samoa'))
    expect_that(name_of('ATA'), equals('Antarctica'))
    expect_that(name_of('ATF'), equals('French Southern Territories'))
    expect_that(name_of('ATG'), equals('Antigua and Barbuda'))
    expect_that(name_of('AUS'), equals('Australia'))
    expect_that(name_of('AUT'), equals('Austria'))
    expect_that(name_of('AZE'), equals('Azerbaijan'))
    expect_that(name_of('BDI'), equals('Burundi'))
    expect_that(name_of('BEL'), equals('Belgium'))
    expect_that(name_of('BEN'), equals('Benin'))
    expect_that(name_of('BES'), equals('Bonaire, Sint Eustatius and Saba'))
    expect_that(name_of('BFA'), equals('Burkina Faso'))
    expect_that(name_of('BGD'), equals('Bangladesh'))
    expect_that(name_of('BGR'), equals('Bulgaria'))
    expect_that(name_of('BHR'), equals('Bahrain'))
    expect_that(name_of('BHS'), equals('Bahamas'))
    expect_that(name_of('BIH'), equals('Bosnia and Herzegovina'))
    expect_that(name_of('BLM'), equals('Saint Barthelemy'))
    expect_that(name_of('BLR'), equals('Belarus'))
    expect_that(name_of('BLZ'), equals('Belize'))
    expect_that(name_of('BMU'), equals('Bermuda'))
    expect_that(name_of('BOL'), equals('Bolivia, Plurinational State of'))
    expect_that(name_of('BRA'), equals('Brazil'))
    expect_that(name_of('BRB'), equals('Barbados'))
    expect_that(name_of('BRN'), equals('Brunei Darussalam'))
    expect_that(name_of('BTN'), equals('Bhutan'))
    expect_that(name_of('BVT'), equals('Bouvet Island'))
    expect_that(name_of('BWA'), equals('Botswana'))
    expect_that(name_of('CAF'), equals('Central African Republic'))
    expect_that(name_of('CAN'), equals('Canada'))
    expect_that(name_of('CCK'), equals('Cocos (Keeling) Islands'))
    expect_that(name_of('CHE'), equals('Switzerland'))
    expect_that(name_of('CHL'), equals('Chile'))
    expect_that(name_of('CHN'), equals('China'))
    expect_that(name_of('CIV'), equals('Cote d\'Ivoire'))
    expect_that(name_of('CMR'), equals('Cameroon'))
    expect_that(name_of('COD'), equals('Congo, the Democratic Republic of the'))
    expect_that(name_of('COG'), equals('Congo'))
    expect_that(name_of('COK'), equals('Cook Islands'))
    expect_that(name_of('COL'), equals('Colombia'))
    expect_that(name_of('COM'), equals('Comoros'))
    expect_that(name_of('CPV'), equals('Cabo Verde'))
    expect_that(name_of('CRI'), equals('Costa Rica'))
    expect_that(name_of('CUB'), equals('Cuba'))
    expect_that(name_of('CUW'), equals('Curacao'))
    expect_that(name_of('CXR'), equals('Christmas Island'))
    expect_that(name_of('CYM'), equals('Cayman Islands'))
    expect_that(name_of('CYP'), equals('Cyprus'))
    expect_that(name_of('CZE'), equals('Czech Republic'))
    expect_that(name_of('DEU'), equals('Germany'))
    expect_that(name_of('DJI'), equals('Djibouti'))
    expect_that(name_of('DMA'), equals('Dominica'))
    expect_that(name_of('DNK'), equals('Denmark'))
    expect_that(name_of('DOM'), equals('Dominican Republic'))
    expect_that(name_of('DZA'), equals('Algeria'))
    expect_that(name_of('ECU'), equals('Ecuador'))
    expect_that(name_of('EGY'), equals('Egypt'))
    expect_that(name_of('ERI'), equals('Eritrea'))
    expect_that(name_of('ESH'), equals('Western Sahara'))
    expect_that(name_of('ESP'), equals('Spain'))
    expect_that(name_of('EST'), equals('Estonia'))
    expect_that(name_of('ETH'), equals('Ethiopia'))
    expect_that(name_of('FIN'), equals('Finland'))
    expect_that(name_of('FJI'), equals('Fiji'))
    expect_that(name_of('FLK'), equals('Falkland Islands (Malvinas)'))
    expect_that(name_of('FRA'), equals('France'))
    expect_that(name_of('FRO'), equals('Faroe Islands'))
    expect_that(name_of('FSM'), equals('Micronesia, Federated States of'))
    expect_that(name_of('GAB'), equals('Gabon'))
    expect_that(name_of('GBR'), equals('United Kingdom'))
    expect_that(name_of('GEO'), equals('Georgia'))
    expect_that(name_of('GGY'), equals('Guernsey'))
    expect_that(name_of('GHA'), equals('Ghana'))
    expect_that(name_of('GIB'), equals('Gibraltar'))
    expect_that(name_of('GIN'), equals('Guinea'))
    expect_that(name_of('GLP'), equals('Guadeloupe'))
    expect_that(name_of('GMB'), equals('Gambia'))
    expect_that(name_of('GNB'), equals('Guinea-Bissau'))
    expect_that(name_of('GNQ'), equals('Equatorial Guinea'))
    expect_that(name_of('GRC'), equals('Greece'))
    expect_that(name_of('GRD'), equals('Grenada'))
    expect_that(name_of('GRL'), equals('Greenland'))
    expect_that(name_of('GTM'), equals('Guatemala'))
    expect_that(name_of('GUF'), equals('French Guiana'))
    expect_that(name_of('GUM'), equals('Guam'))
    expect_that(name_of('GUY'), equals('Guyana'))
    expect_that(name_of('HKG'), equals('Hong Kong'))
    expect_that(name_of('HMD'), equals('Heard Island and McDonald Islands'))
    expect_that(name_of('HND'), equals('Honduras'))
    expect_that(name_of('HRV'), equals('Croatia'))
    expect_that(name_of('HTI'), equals('Haiti'))
    expect_that(name_of('HUN'), equals('Hungary'))
    expect_that(name_of('IDN'), equals('Indonesia'))
    expect_that(name_of('IMN'), equals('Isle of Man'))
    expect_that(name_of('IND'), equals('India'))
    expect_that(name_of('IOT'), equals('British Indian Ocean Territory'))
    expect_that(name_of('IRL'), equals('Ireland'))
    expect_that(name_of('IRN'), equals('Iran, Islamic Republic of'))
    expect_that(name_of('IRQ'), equals('Iraq'))
    expect_that(name_of('ISL'), equals('Iceland'))
    expect_that(name_of('ISR'), equals('Israel'))
    expect_that(name_of('ITA'), equals('Italy'))
    expect_that(name_of('JAM'), equals('Jamaica'))
    expect_that(name_of('JEY'), equals('Jersey'))
    expect_that(name_of('JOR'), equals('Jordan'))
    expect_that(name_of('JPN'), equals('Japan'))
    expect_that(name_of('KAZ'), equals('Kazakhstan'))
    expect_that(name_of('KEN'), equals('Kenya'))
    expect_that(name_of('KGZ'), equals('Kyrgyzstan'))
    expect_that(name_of('KHM'), equals('Cambodia'))
    expect_that(name_of('KIR'), equals('Kiribati'))
    expect_that(name_of('KNA'), equals('Saint Kitts and Nevis'))
    expect_that(name_of('KOR'), equals('Korea, Republic of'))
    expect_that(name_of('KWT'), equals('Kuwait'))
    expect_that(name_of('LAO'), equals('Lao People\'s Democratic Republic'))
    expect_that(name_of('LBN'), equals('Lebanon'))
    expect_that(name_of('LBR'), equals('Liberia'))
    expect_that(name_of('LBY'), equals('Libya'))
    expect_that(name_of('LCA'), equals('Saint Lucia'))
    expect_that(name_of('LIE'), equals('Liechtenstein'))
    expect_that(name_of('LKA'), equals('Sri Lanka'))
    expect_that(name_of('LSO'), equals('Lesotho'))
    expect_that(name_of('LTU'), equals('Lithuania'))
    expect_that(name_of('LUX'), equals('Luxembourg'))
    expect_that(name_of('LVA'), equals('Latvia'))
    expect_that(name_of('MAC'), equals('Macao'))
    expect_that(name_of('MAF'), equals('Saint Martin (French part)'))
    expect_that(name_of('MAR'), equals('Morocco'))
    expect_that(name_of('MCO'), equals('Monaco'))
    expect_that(name_of('MDA'), equals('Moldova, Republic of'))
    expect_that(name_of('MDG'), equals('Madagascar'))
    expect_that(name_of('MDV'), equals('Maldives'))
    expect_that(name_of('MEX'), equals('Mexico'))
    expect_that(name_of('MHL'), equals('Marshall Islands'))
    expect_that(name_of('MKD'), equals('Macedonia, the former Yugoslav Republic of'))
    expect_that(name_of('MLI'), equals('Mali'))
    expect_that(name_of('MLT'), equals('Malta'))
    expect_that(name_of('MMR'), equals('Myanmar'))
    expect_that(name_of('MNE'), equals('Montenegro'))
    expect_that(name_of('MNG'), equals('Mongolia'))
    expect_that(name_of('MNP'), equals('Northern Mariana Islands'))
    expect_that(name_of('MOZ'), equals('Mozambique'))
    expect_that(name_of('MRT'), equals('Mauritania'))
    expect_that(name_of('MSR'), equals('Montserrat'))
    expect_that(name_of('MTQ'), equals('Martinique'))
    expect_that(name_of('MUS'), equals('Mauritius'))
    expect_that(name_of('MWI'), equals('Malawi'))
    expect_that(name_of('MYS'), equals('Malaysia'))
    expect_that(name_of('MYT'), equals('Mayotte'))
    expect_that(name_of('NAM'), equals('Namibia'))
    expect_that(name_of('NCL'), equals('New Caledonia'))
    expect_that(name_of('NER'), equals('Niger'))
    expect_that(name_of('NFK'), equals('Norfolk Island'))
    expect_that(name_of('NGA'), equals('Nigeria'))
    expect_that(name_of('NIC'), equals('Nicaragua'))
    expect_that(name_of('NIU'), equals('Niue'))
    expect_that(name_of('NLD'), equals('Netherlands'))
    expect_that(name_of('NOR'), equals('Norway'))
    expect_that(name_of('NPL'), equals('Nepal'))
    expect_that(name_of('NRU'), equals('Nauru'))
    expect_that(name_of('NZL'), equals('New Zealand'))
    expect_that(name_of('OMN'), equals('Oman'))
    expect_that(name_of('PAK'), equals('Pakistan'))
    expect_that(name_of('PAN'), equals('Panama'))
    expect_that(name_of('PCN'), equals('Pitcairn'))
    expect_that(name_of('PER'), equals('Peru'))
    expect_that(name_of('PHL'), equals('Philippines'))
    expect_that(name_of('PLW'), equals('Palau'))
    expect_that(name_of('PNG'), equals('Papua New Guinea'))
    expect_that(name_of('POL'), equals('Poland'))
    expect_that(name_of('PRI'), equals('Puerto Rico'))
    expect_that(name_of('PRK'), equals('Korea, Democratic People\'s Republic of'))
    expect_that(name_of('PRT'), equals('Portugal'))
    expect_that(name_of('PRY'), equals('Paraguay'))
    expect_that(name_of('PSE'), equals('Palestine, State of'))
    expect_that(name_of('PYF'), equals('French Polynesia'))
    expect_that(name_of('QAT'), equals('Qatar'))
    expect_that(name_of('REU'), equals('Reunion'))
    expect_that(name_of('ROU'), equals('Romania'))
    expect_that(name_of('RUS'), equals('Russian Federation'))
    expect_that(name_of('RWA'), equals('Rwanda'))
    expect_that(name_of('SAU'), equals('Saudi Arabia'))
    expect_that(name_of('SDN'), equals('Sudan'))
    expect_that(name_of('SEN'), equals('Senegal'))
    expect_that(name_of('SGP'), equals('Singapore'))
    expect_that(name_of('SGS'), equals('South Georgia and the South Sandwich Islands'))
    expect_that(name_of('SHN'), equals('Saint Helena, Ascension and Tristan da Cunha'))
    expect_that(name_of('SJM'), equals('Svalbard and Jan Mayen'))
    expect_that(name_of('SLB'), equals('Solomon Islands'))
    expect_that(name_of('SLE'), equals('Sierra Leone'))
    expect_that(name_of('SLV'), equals('El Salvador'))
    expect_that(name_of('SMR'), equals('San Marino'))
    expect_that(name_of('SOM'), equals('Somalia'))
    expect_that(name_of('SPM'), equals('Saint Pierre and Miquelon'))
    expect_that(name_of('SRB'), equals('Serbia'))
    expect_that(name_of('SSD'), equals('South Sudan'))
    expect_that(name_of('STP'), equals('Sao Tome and Principe'))
    expect_that(name_of('SUR'), equals('Suriname'))
    expect_that(name_of('SVK'), equals('Slovakia'))
    expect_that(name_of('SVN'), equals('Slovenia'))
    expect_that(name_of('SWE'), equals('Sweden'))
    expect_that(name_of('SWZ'), equals('Swaziland'))
    expect_that(name_of('SXM'), equals('Sint Maarten (Dutch part)'))
    expect_that(name_of('SYC'), equals('Seychelles'))
    expect_that(name_of('SYR'), equals('Syrian Arab Republic'))
    expect_that(name_of('TCA'), equals('Turks and Caicos Islands'))
    expect_that(name_of('TCD'), equals('Chad'))
    expect_that(name_of('TGO'), equals('Togo'))
    expect_that(name_of('THA'), equals('Thailand'))
    expect_that(name_of('TJK'), equals('Tajikistan'))
    expect_that(name_of('TKL'), equals('Tokelau'))
    expect_that(name_of('TKM'), equals('Turkmenistan'))
    expect_that(name_of('TLS'), equals('Timor-Leste'))
    expect_that(name_of('TON'), equals('Tonga'))
    expect_that(name_of('TTO'), equals('Trinidad and Tobago'))
    expect_that(name_of('TUN'), equals('Tunisia'))
    expect_that(name_of('TUR'), equals('Turkey'))
    expect_that(name_of('TUV'), equals('Tuvalu'))
    expect_that(name_of('TWN'), equals('Taiwan, Province of China'))
    expect_that(name_of('TZA'), equals('Tanzania, United Republic of'))
    expect_that(name_of('UGA'), equals('Uganda'))
    expect_that(name_of('UKR'), equals('Ukraine'))
    expect_that(name_of('UMI'), equals('United States Minor Outlying Islands'))
    expect_that(name_of('URY'), equals('Uruguay'))
    expect_that(name_of('USA'), equals('United States'))
    expect_that(name_of('UZB'), equals('Uzbekistan'))
    expect_that(name_of('VAT'), equals('Holy See (Vatican City State)'))
    expect_that(name_of('VCT'), equals('Saint Vincent and the Grenadines'))
    expect_that(name_of('VEN'), equals('Venezuela, Bolivarian Republic of'))
    expect_that(name_of('VGB'), equals('Virgin Islands, British'))
    expect_that(name_of('VIR'), equals('Virgin Islands, U.S.'))
    expect_that(name_of('VNM'), equals('Viet Nam'))
    expect_that(name_of('VUT'), equals('Vanuatu'))
    expect_that(name_of('WLF'), equals('Wallis and Futuna'))
    expect_that(name_of('WSM'), equals('Samoa'))
    expect_that(name_of('YEM'), equals('Yemen'))
    expect_that(name_of('ZAF'), equals('South Africa'))
    expect_that(name_of('ZMB'), equals('Zambia'))
    expect_that(name_of('ZWE'), equals('Zimbabwe'))
})
muuankarski/countrycode.multilang documentation built on May 23, 2019, 10:52 a.m.