-
Notifications
You must be signed in to change notification settings - Fork 2
/
data_test.go
280 lines (277 loc) · 10.9 KB
/
data_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
package iso3166_test
import (
"testing"
"github.com/ferdypruis/iso3166"
)
// TestData asserts existing codes never change
func TestData(t *testing.T) {
tests := map[string]struct {
c iso3166.Country
alpha2 string
alpha3 string
number string
}{
"AD": {iso3166.AD, "AD", "AND", "020"},
"AE": {iso3166.AE, "AE", "ARE", "784"},
"AF": {iso3166.AF, "AF", "AFG", "004"},
"AG": {iso3166.AG, "AG", "ATG", "028"},
"AI": {iso3166.AI, "AI", "AIA", "660"},
"AL": {iso3166.AL, "AL", "ALB", "008"},
"AM": {iso3166.AM, "AM", "ARM", "051"},
"AO": {iso3166.AO, "AO", "AGO", "024"},
"AQ": {iso3166.AQ, "AQ", "ATA", "010"},
"AR": {iso3166.AR, "AR", "ARG", "032"},
"AS": {iso3166.AS, "AS", "ASM", "016"},
"AT": {iso3166.AT, "AT", "AUT", "040"},
"AU": {iso3166.AU, "AU", "AUS", "036"},
"AW": {iso3166.AW, "AW", "ABW", "533"},
"AX": {iso3166.AX, "AX", "ALA", "248"},
"AZ": {iso3166.AZ, "AZ", "AZE", "031"},
"BA": {iso3166.BA, "BA", "BIH", "070"},
"BB": {iso3166.BB, "BB", "BRB", "052"},
"BD": {iso3166.BD, "BD", "BGD", "050"},
"BE": {iso3166.BE, "BE", "BEL", "056"},
"BF": {iso3166.BF, "BF", "BFA", "854"},
"BG": {iso3166.BG, "BG", "BGR", "100"},
"BH": {iso3166.BH, "BH", "BHR", "048"},
"BI": {iso3166.BI, "BI", "BDI", "108"},
"BJ": {iso3166.BJ, "BJ", "BEN", "204"},
"BL": {iso3166.BL, "BL", "BLM", "652"},
"BM": {iso3166.BM, "BM", "BMU", "060"},
"BN": {iso3166.BN, "BN", "BRN", "096"},
"BO": {iso3166.BO, "BO", "BOL", "068"},
"BQ": {iso3166.BQ, "BQ", "BES", "535"},
"BR": {iso3166.BR, "BR", "BRA", "076"},
"BS": {iso3166.BS, "BS", "BHS", "044"},
"BT": {iso3166.BT, "BT", "BTN", "064"},
"BV": {iso3166.BV, "BV", "BVT", "074"},
"BW": {iso3166.BW, "BW", "BWA", "072"},
"BY": {iso3166.BY, "BY", "BLR", "112"},
"BZ": {iso3166.BZ, "BZ", "BLZ", "084"},
"CA": {iso3166.CA, "CA", "CAN", "124"},
"CC": {iso3166.CC, "CC", "CCK", "166"},
"CD": {iso3166.CD, "CD", "COD", "180"},
"CF": {iso3166.CF, "CF", "CAF", "140"},
"CG": {iso3166.CG, "CG", "COG", "178"},
"CH": {iso3166.CH, "CH", "CHE", "756"},
"CI": {iso3166.CI, "CI", "CIV", "384"},
"CK": {iso3166.CK, "CK", "COK", "184"},
"CL": {iso3166.CL, "CL", "CHL", "152"},
"CM": {iso3166.CM, "CM", "CMR", "120"},
"CN": {iso3166.CN, "CN", "CHN", "156"},
"CO": {iso3166.CO, "CO", "COL", "170"},
"CR": {iso3166.CR, "CR", "CRI", "188"},
"CU": {iso3166.CU, "CU", "CUB", "192"},
"CV": {iso3166.CV, "CV", "CPV", "132"},
"CW": {iso3166.CW, "CW", "CUW", "531"},
"CX": {iso3166.CX, "CX", "CXR", "162"},
"CY": {iso3166.CY, "CY", "CYP", "196"},
"CZ": {iso3166.CZ, "CZ", "CZE", "203"},
"DE": {iso3166.DE, "DE", "DEU", "276"},
"DJ": {iso3166.DJ, "DJ", "DJI", "262"},
"DK": {iso3166.DK, "DK", "DNK", "208"},
"DM": {iso3166.DM, "DM", "DMA", "212"},
"DO": {iso3166.DO, "DO", "DOM", "214"},
"DZ": {iso3166.DZ, "DZ", "DZA", "012"},
"EC": {iso3166.EC, "EC", "ECU", "218"},
"EE": {iso3166.EE, "EE", "EST", "233"},
"EG": {iso3166.EG, "EG", "EGY", "818"},
"EH": {iso3166.EH, "EH", "ESH", "732"},
"ER": {iso3166.ER, "ER", "ERI", "232"},
"ES": {iso3166.ES, "ES", "ESP", "724"},
"ET": {iso3166.ET, "ET", "ETH", "231"},
"FI": {iso3166.FI, "FI", "FIN", "246"},
"FJ": {iso3166.FJ, "FJ", "FJI", "242"},
"FK": {iso3166.FK, "FK", "FLK", "238"},
"FM": {iso3166.FM, "FM", "FSM", "583"},
"FO": {iso3166.FO, "FO", "FRO", "234"},
"FR": {iso3166.FR, "FR", "FRA", "250"},
"GA": {iso3166.GA, "GA", "GAB", "266"},
"GB": {iso3166.GB, "GB", "GBR", "826"},
"GD": {iso3166.GD, "GD", "GRD", "308"},
"GE": {iso3166.GE, "GE", "GEO", "268"},
"GF": {iso3166.GF, "GF", "GUF", "254"},
"GG": {iso3166.GG, "GG", "GGY", "831"},
"GH": {iso3166.GH, "GH", "GHA", "288"},
"GI": {iso3166.GI, "GI", "GIB", "292"},
"GL": {iso3166.GL, "GL", "GRL", "304"},
"GM": {iso3166.GM, "GM", "GMB", "270"},
"GN": {iso3166.GN, "GN", "GIN", "324"},
"GP": {iso3166.GP, "GP", "GLP", "312"},
"GQ": {iso3166.GQ, "GQ", "GNQ", "226"},
"GR": {iso3166.GR, "GR", "GRC", "300"},
"GS": {iso3166.GS, "GS", "SGS", "239"},
"GT": {iso3166.GT, "GT", "GTM", "320"},
"GU": {iso3166.GU, "GU", "GUM", "316"},
"GW": {iso3166.GW, "GW", "GNB", "624"},
"GY": {iso3166.GY, "GY", "GUY", "328"},
"HK": {iso3166.HK, "HK", "HKG", "344"},
"HM": {iso3166.HM, "HM", "HMD", "334"},
"HN": {iso3166.HN, "HN", "HND", "340"},
"HR": {iso3166.HR, "HR", "HRV", "191"},
"HT": {iso3166.HT, "HT", "HTI", "332"},
"HU": {iso3166.HU, "HU", "HUN", "348"},
"ID": {iso3166.ID, "ID", "IDN", "360"},
"IE": {iso3166.IE, "IE", "IRL", "372"},
"IL": {iso3166.IL, "IL", "ISR", "376"},
"IM": {iso3166.IM, "IM", "IMN", "833"},
"IN": {iso3166.IN, "IN", "IND", "356"},
"IO": {iso3166.IO, "IO", "IOT", "086"},
"IQ": {iso3166.IQ, "IQ", "IRQ", "368"},
"IR": {iso3166.IR, "IR", "IRN", "364"},
"IS": {iso3166.IS, "IS", "ISL", "352"},
"IT": {iso3166.IT, "IT", "ITA", "380"},
"JE": {iso3166.JE, "JE", "JEY", "832"},
"JM": {iso3166.JM, "JM", "JAM", "388"},
"JO": {iso3166.JO, "JO", "JOR", "400"},
"JP": {iso3166.JP, "JP", "JPN", "392"},
"KE": {iso3166.KE, "KE", "KEN", "404"},
"KG": {iso3166.KG, "KG", "KGZ", "417"},
"KH": {iso3166.KH, "KH", "KHM", "116"},
"KI": {iso3166.KI, "KI", "KIR", "296"},
"KM": {iso3166.KM, "KM", "COM", "174"},
"KN": {iso3166.KN, "KN", "KNA", "659"},
"KP": {iso3166.KP, "KP", "PRK", "408"},
"KR": {iso3166.KR, "KR", "KOR", "410"},
"KW": {iso3166.KW, "KW", "KWT", "414"},
"KY": {iso3166.KY, "KY", "CYM", "136"},
"KZ": {iso3166.KZ, "KZ", "KAZ", "398"},
"LA": {iso3166.LA, "LA", "LAO", "418"},
"LB": {iso3166.LB, "LB", "LBN", "422"},
"LC": {iso3166.LC, "LC", "LCA", "662"},
"LI": {iso3166.LI, "LI", "LIE", "438"},
"LK": {iso3166.LK, "LK", "LKA", "144"},
"LR": {iso3166.LR, "LR", "LBR", "430"},
"LS": {iso3166.LS, "LS", "LSO", "426"},
"LT": {iso3166.LT, "LT", "LTU", "440"},
"LU": {iso3166.LU, "LU", "LUX", "442"},
"LV": {iso3166.LV, "LV", "LVA", "428"},
"LY": {iso3166.LY, "LY", "LBY", "434"},
"MA": {iso3166.MA, "MA", "MAR", "504"},
"MC": {iso3166.MC, "MC", "MCO", "492"},
"MD": {iso3166.MD, "MD", "MDA", "498"},
"ME": {iso3166.ME, "ME", "MNE", "499"},
"MF": {iso3166.MF, "MF", "MAF", "663"},
"MG": {iso3166.MG, "MG", "MDG", "450"},
"MH": {iso3166.MH, "MH", "MHL", "584"},
"MK": {iso3166.MK, "MK", "MKD", "807"},
"ML": {iso3166.ML, "ML", "MLI", "466"},
"MM": {iso3166.MM, "MM", "MMR", "104"},
"MN": {iso3166.MN, "MN", "MNG", "496"},
"MO": {iso3166.MO, "MO", "MAC", "446"},
"MP": {iso3166.MP, "MP", "MNP", "580"},
"MQ": {iso3166.MQ, "MQ", "MTQ", "474"},
"MR": {iso3166.MR, "MR", "MRT", "478"},
"MS": {iso3166.MS, "MS", "MSR", "500"},
"MT": {iso3166.MT, "MT", "MLT", "470"},
"MU": {iso3166.MU, "MU", "MUS", "480"},
"MV": {iso3166.MV, "MV", "MDV", "462"},
"MW": {iso3166.MW, "MW", "MWI", "454"},
"MX": {iso3166.MX, "MX", "MEX", "484"},
"MY": {iso3166.MY, "MY", "MYS", "458"},
"MZ": {iso3166.MZ, "MZ", "MOZ", "508"},
"NA": {iso3166.NA, "NA", "NAM", "516"},
"NC": {iso3166.NC, "NC", "NCL", "540"},
"NE": {iso3166.NE, "NE", "NER", "562"},
"NF": {iso3166.NF, "NF", "NFK", "574"},
"NG": {iso3166.NG, "NG", "NGA", "566"},
"NI": {iso3166.NI, "NI", "NIC", "558"},
"NL": {iso3166.NL, "NL", "NLD", "528"},
"NO": {iso3166.NO, "NO", "NOR", "578"},
"NP": {iso3166.NP, "NP", "NPL", "524"},
"NR": {iso3166.NR, "NR", "NRU", "520"},
"NU": {iso3166.NU, "NU", "NIU", "570"},
"NZ": {iso3166.NZ, "NZ", "NZL", "554"},
"OM": {iso3166.OM, "OM", "OMN", "512"},
"PA": {iso3166.PA, "PA", "PAN", "591"},
"PE": {iso3166.PE, "PE", "PER", "604"},
"PF": {iso3166.PF, "PF", "PYF", "258"},
"PG": {iso3166.PG, "PG", "PNG", "598"},
"PH": {iso3166.PH, "PH", "PHL", "608"},
"PK": {iso3166.PK, "PK", "PAK", "586"},
"PL": {iso3166.PL, "PL", "POL", "616"},
"PM": {iso3166.PM, "PM", "SPM", "666"},
"PN": {iso3166.PN, "PN", "PCN", "612"},
"PR": {iso3166.PR, "PR", "PRI", "630"},
"PS": {iso3166.PS, "PS", "PSE", "275"},
"PT": {iso3166.PT, "PT", "PRT", "620"},
"PW": {iso3166.PW, "PW", "PLW", "585"},
"PY": {iso3166.PY, "PY", "PRY", "600"},
"QA": {iso3166.QA, "QA", "QAT", "634"},
"RE": {iso3166.RE, "RE", "REU", "638"},
"RO": {iso3166.RO, "RO", "ROU", "642"},
"RS": {iso3166.RS, "RS", "SRB", "688"},
"RU": {iso3166.RU, "RU", "RUS", "643"},
"RW": {iso3166.RW, "RW", "RWA", "646"},
"SA": {iso3166.SA, "SA", "SAU", "682"},
"SB": {iso3166.SB, "SB", "SLB", "090"},
"SC": {iso3166.SC, "SC", "SYC", "690"},
"SD": {iso3166.SD, "SD", "SDN", "729"},
"SE": {iso3166.SE, "SE", "SWE", "752"},
"SG": {iso3166.SG, "SG", "SGP", "702"},
"SH": {iso3166.SH, "SH", "SHN", "654"},
"SI": {iso3166.SI, "SI", "SVN", "705"},
"SJ": {iso3166.SJ, "SJ", "SJM", "744"},
"SK": {iso3166.SK, "SK", "SVK", "703"},
"SL": {iso3166.SL, "SL", "SLE", "694"},
"SM": {iso3166.SM, "SM", "SMR", "674"},
"SN": {iso3166.SN, "SN", "SEN", "686"},
"SO": {iso3166.SO, "SO", "SOM", "706"},
"SR": {iso3166.SR, "SR", "SUR", "740"},
"SS": {iso3166.SS, "SS", "SSD", "728"},
"ST": {iso3166.ST, "ST", "STP", "678"},
"SV": {iso3166.SV, "SV", "SLV", "222"},
"SX": {iso3166.SX, "SX", "SXM", "534"},
"SY": {iso3166.SY, "SY", "SYR", "760"},
"SZ": {iso3166.SZ, "SZ", "SWZ", "748"},
"TC": {iso3166.TC, "TC", "TCA", "796"},
"TD": {iso3166.TD, "TD", "TCD", "148"},
"TF": {iso3166.TF, "TF", "ATF", "260"},
"TG": {iso3166.TG, "TG", "TGO", "768"},
"TH": {iso3166.TH, "TH", "THA", "764"},
"TJ": {iso3166.TJ, "TJ", "TJK", "762"},
"TK": {iso3166.TK, "TK", "TKL", "772"},
"TL": {iso3166.TL, "TL", "TLS", "626"},
"TM": {iso3166.TM, "TM", "TKM", "795"},
"TN": {iso3166.TN, "TN", "TUN", "788"},
"TO": {iso3166.TO, "TO", "TON", "776"},
"TR": {iso3166.TR, "TR", "TUR", "792"},
"TT": {iso3166.TT, "TT", "TTO", "780"},
"TV": {iso3166.TV, "TV", "TUV", "798"},
"TW": {iso3166.TW, "TW", "TWN", "158"},
"TZ": {iso3166.TZ, "TZ", "TZA", "834"},
"UA": {iso3166.UA, "UA", "UKR", "804"},
"UG": {iso3166.UG, "UG", "UGA", "800"},
"UM": {iso3166.UM, "UM", "UMI", "581"},
"US": {iso3166.US, "US", "USA", "840"},
"UY": {iso3166.UY, "UY", "URY", "858"},
"UZ": {iso3166.UZ, "UZ", "UZB", "860"},
"VA": {iso3166.VA, "VA", "VAT", "336"},
"VC": {iso3166.VC, "VC", "VCT", "670"},
"VE": {iso3166.VE, "VE", "VEN", "862"},
"VG": {iso3166.VG, "VG", "VGB", "092"},
"VI": {iso3166.VI, "VI", "VIR", "850"},
"VN": {iso3166.VN, "VN", "VNM", "704"},
"VU": {iso3166.VU, "VU", "VUT", "548"},
"WF": {iso3166.WF, "WF", "WLF", "876"},
"WS": {iso3166.WS, "WS", "WSM", "882"},
"YE": {iso3166.YE, "YE", "YEM", "887"},
"YT": {iso3166.YT, "YT", "MYT", "175"},
"ZA": {iso3166.ZA, "ZA", "ZAF", "710"},
"ZM": {iso3166.ZM, "ZM", "ZMB", "894"},
"ZW": {iso3166.ZW, "ZW", "ZWE", "716"},
}
for name, tt := range tests {
t.Run(name, func(t *testing.T) {
if got := tt.c.Alpha2(); got != tt.alpha2 {
t.Errorf("%s.Alpha2() = %v, want %v", name, got, tt.alpha2)
}
if got := tt.c.Alpha3(); got != tt.alpha3 {
t.Errorf("%s.Alpha3() = %v, want %v", name, got, tt.alpha3)
}
if got := tt.c.Numeric(); got != tt.number {
t.Errorf("%s.Numeric() = %v, want %v", name, got, tt.number)
}
})
}
}