Read misc.territory, timezone, useragent and car as tables, and state the data rules behind them #23
@@ -108,6 +108,7 @@ func TestShippedMiscReferenceData(t *testing.T) {
|
|||||||
"timezone": regexp.MustCompile(`^[A-Za-z]+(/[A-Za-z0-9_+-]+)+$`),
|
"timezone": regexp.MustCompile(`^[A-Za-z]+(/[A-Za-z0-9_+-]+)+$`),
|
||||||
"timezone.offset": regexp.MustCompile(`^[+-](0\d|1[0-4]):[0-5]\d$`),
|
"timezone.offset": regexp.MustCompile(`^[+-](0\d|1[0-4]):[0-5]\d$`),
|
||||||
"timezone.territory": regexp.MustCompile(`^[A-Z]{2}$`),
|
"timezone.territory": regexp.MustCompile(`^[A-Z]{2}$`),
|
||||||
|
"timezone.weight": regexp.MustCompile(`^[1-9]\d*$`),
|
||||||
"mimetype": regexp.MustCompile(`^[a-z]+/[a-z0-9.+-]+$`),
|
"mimetype": regexp.MustCompile(`^[a-z]+/[a-z0-9.+-]+$`),
|
||||||
"mimetype.ext": regexp.MustCompile(`^\.[a-z0-9_-]+$`),
|
"mimetype.ext": regexp.MustCompile(`^\.[a-z0-9_-]+$`),
|
||||||
"httpstatus": regexp.MustCompile(`^[1-5]\d{2} \S.*$`),
|
"httpstatus": regexp.MustCompile(`^[1-5]\d{2} \S.*$`),
|
||||||
|
|||||||
@@ -738,6 +738,13 @@ func TestShippedTables(t *testing.T) {
|
|||||||
t.Fatalf("%q: a territory and a timezone in one render disagree on the territory", got)
|
t.Fatalf("%q: a territory and a timezone in one render disagree on the territory", got)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
zones := map[string]int{}
|
||||||
|
for i := 0; i < 2000; i++ {
|
||||||
|
zones[fake(t, f, "territory[US].timezone")]++
|
||||||
|
}
|
||||||
|
if peopled := zones["America/New_York"] + zones["America/Chicago"] + zones["America/Los_Angeles"] + zones["America/Denver"]; peopled < 1600 {
|
||||||
|
t.Fatalf("the four zones most Americans live in take %d of 2000 US draws, want the population weight to favour them", peopled)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestEveryTerritoryNamesAShippedCountry proves what no parent can: the sovereign a
|
// TestEveryTerritoryNamesAShippedCountry proves what no parent can: the sovereign a
|
||||||
|
|||||||
Reference in New Issue
Block a user