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