Expect IANA's method, protocol and port registries as tables
This commit is contained in:
+32
-24
@@ -95,30 +95,38 @@ func TestShippedMiscCategories(t *testing.T) {
|
||||
func TestShippedMiscReferenceData(t *testing.T) {
|
||||
f := newGenerator(t, "data/misc", WithSeed(1))
|
||||
re := map[string]*regexp.Regexp{
|
||||
"currency": regexp.MustCompile(`^[A-Z]{3}$`),
|
||||
"currency.name": regexp.MustCompile(`\p{L}`),
|
||||
"currency.symbol": regexp.MustCompile(`^\S+$`),
|
||||
"territory": regexp.MustCompile(`\p{L}`),
|
||||
"territory.alpha2": regexp.MustCompile(`^[A-Z]{2}$`),
|
||||
"territory.alpha3": regexp.MustCompile(`^[A-Z]{3}$`),
|
||||
"territory.country": regexp.MustCompile(`^[A-Z]{2}$`),
|
||||
"language": regexp.MustCompile(`\p{L}`),
|
||||
"language.code": regexp.MustCompile(`^[a-z]{2}$`),
|
||||
"language.code3": regexp.MustCompile(`^[a-z]{3}$`),
|
||||
"timezone": regexp.MustCompile(`^[A-Za-z]+(/[A-Za-z0-9_+-]+)+$`),
|
||||
"timezone.offset": regexp.MustCompile(`^[+-](0\d|1[0-4]):[0-5]\d$`),
|
||||
"timezone.territory": regexp.MustCompile(`^[A-Z]{2}$`),
|
||||
"timezone.weight": regexp.MustCompile(`^[1-9]\d*$`),
|
||||
"mimetype": regexp.MustCompile(`^[a-z]+/[a-z0-9.+-]+$`),
|
||||
"mimetype.ext": regexp.MustCompile(`^\.[a-z0-9_-]+$`),
|
||||
"httpstatus": regexp.MustCompile(`^[1-5]\d{2} \S.*$`),
|
||||
"httpstatus.code": regexp.MustCompile(`^[1-5]\d{2}$`),
|
||||
"useragent": regexp.MustCompile(`^Mozilla/5\.0 .+`),
|
||||
"useragent.browser": regexp.MustCompile(`^(Chrome|Edge|Firefox|Opera|Safari|Samsung Internet)$`),
|
||||
"useragent.device": regexp.MustCompile(`^(desktop|mobile)$`),
|
||||
"useragent.os": regexp.MustCompile(`^(Android|ChromeOS|Linux|Windows|iOS|macOS)$`),
|
||||
"car": regexp.MustCompile(`^\S.* \S`),
|
||||
"car.make": regexp.MustCompile(`^\S`),
|
||||
"currency": regexp.MustCompile(`^[A-Z]{3}$`),
|
||||
"currency.name": regexp.MustCompile(`\p{L}`),
|
||||
"currency.symbol": regexp.MustCompile(`^\S+$`),
|
||||
"territory": regexp.MustCompile(`\p{L}`),
|
||||
"territory.alpha2": regexp.MustCompile(`^[A-Z]{2}$`),
|
||||
"territory.alpha3": regexp.MustCompile(`^[A-Z]{3}$`),
|
||||
"territory.country": regexp.MustCompile(`^[A-Z]{2}$`),
|
||||
"language": regexp.MustCompile(`\p{L}`),
|
||||
"language.code": regexp.MustCompile(`^[a-z]{2}$`),
|
||||
"language.code3": regexp.MustCompile(`^[a-z]{3}$`),
|
||||
"timezone": regexp.MustCompile(`^[A-Za-z]+(/[A-Za-z0-9_+-]+)+$`),
|
||||
"timezone.offset": regexp.MustCompile(`^[+-](0\d|1[0-4]):[0-5]\d$`),
|
||||
"timezone.territory": regexp.MustCompile(`^[A-Z]{2}$`),
|
||||
"timezone.weight": regexp.MustCompile(`^[1-9]\d*$`),
|
||||
"mimetype": regexp.MustCompile(`^[a-z]+/[a-z0-9.+-]+$`),
|
||||
"mimetype.ext": regexp.MustCompile(`^\.[a-z0-9_-]+$`),
|
||||
"httpmethod": regexp.MustCompile(`^[A-Za-z][A-Za-z-]*$`),
|
||||
"httpmethod.safe": regexp.MustCompile(`^(yes|no)$`),
|
||||
"httpmethod.idempotent": regexp.MustCompile(`^(yes|no)$`),
|
||||
"port": regexp.MustCompile(`^[1-9]\d{0,4}$`),
|
||||
"port.name": regexp.MustCompile(`^\S+$`),
|
||||
"protocol": regexp.MustCompile(`^\S+( \S+)*$`),
|
||||
"protocol.name": regexp.MustCompile(`\S`),
|
||||
"protocol.number": regexp.MustCompile(`^\d{1,3}$`),
|
||||
"httpstatus": regexp.MustCompile(`^[1-5]\d{2} \S.*$`),
|
||||
"httpstatus.code": regexp.MustCompile(`^[1-5]\d{2}$`),
|
||||
"useragent": regexp.MustCompile(`^Mozilla/5\.0 .+`),
|
||||
"useragent.browser": regexp.MustCompile(`^(Chrome|Edge|Firefox|Opera|Safari|Samsung Internet)$`),
|
||||
"useragent.device": regexp.MustCompile(`^(desktop|mobile)$`),
|
||||
"useragent.os": regexp.MustCompile(`^(Android|ChromeOS|Linux|Windows|iOS|macOS)$`),
|
||||
"car": regexp.MustCompile(`^\S.* \S`),
|
||||
"car.make": regexp.MustCompile(`^\S`),
|
||||
}
|
||||
for i := 0; i < 100; i++ {
|
||||
for p, rx := range re {
|
||||
|
||||
Reference in New Issue
Block a user