{
  "$schema": "../cases.schema.json",
  "format": 1,
  "domain": "state",
  "title": {
    "en": "States (UF)",
    "pt-BR": "Estados (UF)"
  },
  "functions": [
    {
      "id": "state.getByIbgeCode",
      "level": "extended",
      "summary": "Gets the Brazilian state whose 2-digit IBGE code (\"cUF\", the Código da Unidade da Federação) matches the given value.",
      "description": "Returns the state whose 2-digit IBGE code (cUF, the code in the first field of a DF-e access key) matches `code`.\n\n- `code` may be a string or a non-negative integer.\n- A string has every character that is not a digit removed first, as in 2.4.0: `\"35/SP\"` and `\" 35 \"` resolve to São Paulo.\n- A negative or fractional number is not read as a code and returns `null`.\n- The result has the code, name, region code, region name and IBGE code.\n- Returns `null` when the code matches no state.",
      "params": [
        {
          "name": "code",
          "type": "string | number"
        }
      ],
      "returns": "State?",
      "cases": [
        {
          "id": "state.getByIbgeCode#sao-paulo",
          "args": [
            "35"
          ],
          "expect": {
            "returns": {
              "code": "SP",
              "name": "São Paulo",
              "regionCode": "SE",
              "regionName": "Sudeste",
              "ibgeCode": 35
            }
          }
        },
        {
          "id": "state.getByIbgeCode#number",
          "args": [
            35
          ],
          "expect": {
            "returns": {
              "code": "SP",
              "name": "São Paulo",
              "regionCode": "SE",
              "regionName": "Sudeste",
              "ibgeCode": 35
            }
          }
        },
        {
          "id": "state.getByIbgeCode#distrito-federal",
          "args": [
            "53"
          ],
          "expect": {
            "returns": {
              "code": "DF",
              "name": "Distrito Federal",
              "regionCode": "CO",
              "regionName": "Centro-Oeste",
              "ibgeCode": 53
            }
          }
        },
        {
          "id": "state.getByIbgeCode#[\"00\"]",
          "args": [
            "00"
          ],
          "expect": {
            "returns": null
          }
        },
        {
          "id": "state.getByIbgeCode#[\"99\"]",
          "args": [
            "99"
          ],
          "expect": {
            "returns": null
          }
        },
        {
          "id": "state.getByIbgeCode#empty",
          "args": [
            ""
          ],
          "expect": {
            "returns": null
          }
        },
        {
          "id": "state.getByIbgeCode#[-35]",
          "args": [
            -35
          ],
          "expect": {
            "returns": null
          },
          "note": "JavaScript's own test: should return null for a negative number, not read it as the cUF 35"
        },
        {
          "id": "state.getByIbgeCode#[3.5]",
          "args": [
            3.5
          ],
          "expect": {
            "returns": null
          },
          "note": "JavaScript's own test: should return null for a fractional number, not read it as the cUF 35"
        },
        {
          "id": "state.getByIbgeCode#[\"   \"]",
          "args": [
            "   "
          ],
          "expect": {
            "returns": null
          },
          "note": "JavaScript's own test: should return null for whitespace only"
        },
        {
          "id": "state.getByIbgeCode#[\"35/SP\"]",
          "args": [
            "35/SP"
          ],
          "expect": {
            "returns": {
              "code": "SP",
              "name": "São Paulo",
              "regionCode": "SE",
              "regionName": "Sudeste",
              "ibgeCode": 35
            }
          },
          "note": "from the maintainer briefing, #596: every non-digit is removed from a string, as in 2.4.0"
        },
        {
          "id": "state.getByIbgeCode#[\" 35 \"]",
          "args": [
            " 35 "
          ],
          "expect": {
            "returns": {
              "code": "SP",
              "name": "São Paulo",
              "regionCode": "SE",
              "regionName": "Sudeste",
              "ibgeCode": 35
            }
          },
          "note": "from the maintainer briefing, #596: every non-digit is removed from a string, as in 2.4.0"
        },
        {
          "id": "state.getByIbgeCode#[\"0x1\"]",
          "args": [
            "0x1"
          ],
          "expect": {
            "returns": null
          },
          "note": "from the maintainer briefing, #596: `0x1` is read as the digits 01, which is no state"
        }
      ]
    },
    {
      "id": "state.getCapital",
      "level": "extended",
      "summary": "Gets the capital of a Brazilian state as a municipality.",
      "description": "Returns the capital of a state, in the same shape `municipality.getByCode` returns: the 7-digit IBGE code, the name and the state code.\n\n- The match ignores case and surrounding whitespace: `\"to\"` and `\" TO \"` both give Palmas.\n- The Distrito Federal has no municipalities. Its capital is Brasília, with the code the IBGE gives the whole district (5300108).\n- Returns `null` for a string that is not a state code, and for a value that is not a string.\n- The `State` type has no capital field. The capital comes only from this function.\n- Each call returns a new object.",
      "params": [
        {
          "name": "stateCode",
          "type": "string"
        }
      ],
      "returns": "Municipality?",
      "cases": [
        {
          "id": "state.getCapital#[\"SP\"]",
          "args": [
            "SP"
          ],
          "expect": {
            "returns": {
              "code": "3550308",
              "name": "São Paulo",
              "stateCode": "SP"
            }
          },
          "note": "JavaScript's own test: should return the capital of a state"
        },
        {
          "id": "state.getCapital#[\"to\"]",
          "args": [
            "to"
          ],
          "expect": {
            "returns": {
              "code": "1721000",
              "name": "Palmas",
              "stateCode": "TO"
            }
          },
          "note": "from the maintainer briefing, #601"
        },
        {
          "id": "state.getCapital#[\"ZZ\"]",
          "args": [
            "ZZ"
          ],
          "expect": {
            "returns": null
          },
          "note": "from the maintainer briefing, #601"
        },
        {
          "id": "state.getCapital#[\"TO\"]",
          "args": [
            "TO"
          ],
          "expect": {
            "returns": {
              "code": "1721000",
              "name": "Palmas",
              "stateCode": "TO"
            }
          },
          "note": "JavaScript's own test: should return the capital of a state"
        },
        {
          "id": "state.getCapital#[\"RR\"]",
          "args": [
            "RR"
          ],
          "expect": {
            "returns": {
              "code": "1400100",
              "name": "Boa Vista",
              "stateCode": "RR"
            }
          },
          "note": "JavaScript's own test: should return the capital of a state"
        },
        {
          "id": "state.getCapital#[\"DF\"]",
          "args": [
            "DF"
          ],
          "expect": {
            "returns": {
              "code": "5300108",
              "name": "Brasília",
              "stateCode": "DF"
            }
          },
          "note": "JavaScript's own test: should return Brasília for the Distrito Federal"
        },
        {
          "id": "state.getCapital#[\" mg \"]",
          "args": [
            " mg "
          ],
          "expect": {
            "returns": {
              "code": "3106200",
              "name": "Belo Horizonte",
              "stateCode": "MG"
            }
          },
          "note": "JavaScript's own test: should ignore case and surrounding whitespace"
        },
        {
          "id": "state.getCapital#[\"rj\"]",
          "args": [
            "rj"
          ],
          "expect": {
            "returns": {
              "code": "3304557",
              "name": "Rio de Janeiro",
              "stateCode": "RJ"
            }
          }
        },
        {
          "id": "state.getCapital#[\"PE\"]",
          "args": [
            "PE"
          ],
          "expect": {
            "returns": {
              "code": "2611606",
              "name": "Recife",
              "stateCode": "PE"
            }
          },
          "note": "JavaScript's own test: should return Recife for PE"
        },
        {
          "id": "state.getCapital#empty",
          "args": [
            ""
          ],
          "expect": {
            "returns": null
          },
          "note": "JavaScript's own test: should return null for a code that is not a state"
        },
        {
          "id": "state.getCapital#blank",
          "args": [
            "   "
          ],
          "expect": {
            "returns": null
          }
        },
        {
          "id": "state.getCapital#[\"__proto__\"]",
          "args": [
            "__proto__"
          ],
          "expect": {
            "returns": null
          },
          "note": "JavaScript's own test: should return null for a code that is not a state"
        },
        {
          "id": "state.getCapital#[\"S P\"]",
          "args": [
            "S P"
          ],
          "expect": {
            "returns": null
          }
        },
        {
          "id": "state.getCapital#[\"SPX\"]",
          "args": [
            "SPX"
          ],
          "expect": {
            "returns": null
          }
        },
        {
          "id": "state.getCapital#[35]",
          "args": [
            35
          ],
          "expect": {
            "returns": null
          },
          "note": "JavaScript's own test: should return null for a value that is not a string"
        }
      ]
    },
    {
      "id": "state.getCodeByName",
      "level": "extended",
      "summary": "Gets the two-letter code (sigla) of a Brazilian state from its full name.",
      "description": "Returns the two-letter code (sigla) of a state from its full name.\n\n- The match ignores accents, case and surrounding whitespace. Internal whitespace collapses into one space.\n- Only the full name matches. The code (`SP`) and a name written without its spaces (`saopaulo`) return `null`.\n- Returns `null` when no state matches.",
      "params": [
        {
          "name": "name",
          "type": "string"
        }
      ],
      "returns": "string?",
      "cases": [
        {
          "id": "state.getCodeByName#[\"São Paulo\"]",
          "args": [
            "São Paulo"
          ],
          "expect": {
            "returns": "SP"
          }
        },
        {
          "id": "state.getCodeByName#without-accents",
          "args": [
            "Sao Paulo"
          ],
          "expect": {
            "returns": "SP"
          }
        },
        {
          "id": "state.getCodeByName#lowercase",
          "args": [
            "sao paulo"
          ],
          "expect": {
            "returns": "SP"
          }
        },
        {
          "id": "state.getCodeByName#padded",
          "args": [
            "  São Paulo  "
          ],
          "expect": {
            "returns": "SP"
          }
        },
        {
          "id": "state.getCodeByName#[\"Rio Grande do Norte\"]",
          "args": [
            "Rio Grande do Norte"
          ],
          "expect": {
            "returns": "RN"
          }
        },
        {
          "id": "state.getCodeByName#[\"Distrito Federal\"]",
          "args": [
            "Distrito Federal"
          ],
          "expect": {
            "returns": "DF"
          }
        },
        {
          "id": "state.getCodeByName#[\"Neverland\"]",
          "args": [
            "Neverland"
          ],
          "expect": {
            "returns": null
          }
        },
        {
          "id": "state.getCodeByName#empty",
          "args": [
            ""
          ],
          "expect": {
            "returns": null
          }
        },
        {
          "id": "state.getCodeByName#[\"SAO PAULO\"]",
          "args": [
            "SAO PAULO"
          ],
          "expect": {
            "returns": "SP"
          },
          "note": "JavaScript's own test: should be case-insensitive"
        },
        {
          "id": "state.getCodeByName#[\"Rio  de  Janeiro\"]",
          "args": [
            "Rio  de  Janeiro"
          ],
          "expect": {
            "returns": "RJ"
          },
          "note": "JavaScript's own test: should collapse every run of internal whitespace"
        },
        {
          "id": "state.getCodeByName#[\"Rio\\tde\\nJaneiro\"]",
          "args": [
            "Rio\tde\nJaneiro"
          ],
          "expect": {
            "returns": "RJ"
          },
          "note": "JavaScript's own test: should collapse every run of internal whitespace"
        },
        {
          "id": "state.getCodeByName#[\"  sao   paulo  \"]",
          "args": [
            "  sao   paulo  "
          ],
          "expect": {
            "returns": "SP"
          },
          "note": "JavaScript's own test: should collapse every run of internal whitespace"
        },
        {
          "id": "state.getCodeByName#[\"  sao PAULO  \"]",
          "args": [
            "  sao PAULO  "
          ],
          "expect": {
            "returns": "SP"
          },
          "note": "JavaScript's own test: should combine accent removal, casing and trimming together"
        },
        {
          "id": "state.getCodeByName#[\"ceara\"]",
          "args": [
            "ceara"
          ],
          "expect": {
            "returns": "CE"
          },
          "note": "JavaScript's own test: should resolve a multi-word name with accents, the Ceará example"
        },
        {
          "id": "state.getCodeByName#[\"rio grande do sul\"]",
          "args": [
            "rio grande do sul"
          ],
          "expect": {
            "returns": "RS"
          },
          "note": "JavaScript's own test: should resolve a name containing 'do'/'de' particles, the Rio Grande do Sul example"
        },
        {
          "id": "state.getCodeByName#[\"Rio Grande do Sul\"]",
          "args": [
            "Rio Grande do Sul"
          ],
          "expect": {
            "returns": "RS"
          },
          "note": "JavaScript's own test: should distinguish Rio Grande do Norte from Rio Grande do Sul"
        },
        {
          "id": "state.getCodeByName#[\"saopaulo\"]",
          "args": [
            "saopaulo"
          ],
          "expect": {
            "returns": null
          },
          "note": "JavaScript's own test: should not match a name written without the space the published one carries"
        },
        {
          "id": "state.getCodeByName#[\"Mato Grosso\"]",
          "args": [
            "Mato Grosso"
          ],
          "expect": {
            "returns": "MT"
          },
          "note": "JavaScript's own test: should fold the casing to lower case, which leaves ß as it is instead of expanding it to ss"
        },
        {
          "id": "state.getCodeByName#[\"Mato Großo\"]",
          "args": [
            "Mato Großo"
          ],
          "expect": {
            "returns": null
          },
          "note": "JavaScript's own test: should fold the casing to lower case, which leaves ß as it is instead of expanding it to ss"
        },
        {
          "id": "state.getCodeByName#[\"   \"]",
          "args": [
            "   "
          ],
          "expect": {
            "returns": null
          },
          "note": "JavaScript's own test: should return null for whitespace only"
        }
      ]
    },
    {
      "id": "state.getNameByCode",
      "level": "extended",
      "summary": "Gets the full name of a Brazilian state from its two-letter code (sigla).",
      "description": "Returns the full name of a state from its two-letter code (sigla).\n\n- The match ignores case and surrounding whitespace.\n- The legal time of Brazil is the one of Decreto 2.784/1913, as amended by Lei 11.662/2008 (revoked) and Lei 12.876/2013, which restored the zones of Acre and the south-west of Amazonas. The zone names come from the IANA database. Daylight saving time (Decreto 8.112/2013) is not a source of this function.\n- Returns `null` when no state matches.",
      "params": [
        {
          "name": "code",
          "type": "string"
        }
      ],
      "returns": "string?",
      "cases": [
        {
          "id": "state.getNameByCode#[\"SP\"]",
          "args": [
            "SP"
          ],
          "expect": {
            "returns": "São Paulo"
          }
        },
        {
          "id": "state.getNameByCode#lowercase",
          "args": [
            "sp"
          ],
          "expect": {
            "returns": "São Paulo"
          }
        },
        {
          "id": "state.getNameByCode#padded",
          "args": [
            "  RJ  "
          ],
          "expect": {
            "returns": "Rio de Janeiro"
          }
        },
        {
          "id": "state.getNameByCode#[\"DF\"]",
          "args": [
            "DF"
          ],
          "expect": {
            "returns": "Distrito Federal"
          }
        },
        {
          "id": "state.getNameByCode#[\"ZZ\"]",
          "args": [
            "ZZ"
          ],
          "expect": {
            "returns": null
          }
        },
        {
          "id": "state.getNameByCode#empty",
          "args": [
            ""
          ],
          "expect": {
            "returns": null
          }
        },
        {
          "id": "state.getNameByCode#[\"Sp\"]",
          "args": [
            "Sp"
          ],
          "expect": {
            "returns": "São Paulo"
          },
          "note": "JavaScript's own test: should be case-insensitive"
        },
        {
          "id": "state.getNameByCode#[\"  rj  \"]",
          "args": [
            "  rj  "
          ],
          "expect": {
            "returns": "Rio de Janeiro"
          },
          "note": "JavaScript's own test: should combine casing and trimming together"
        },
        {
          "id": "state.getNameByCode#[\"   \"]",
          "args": [
            "   "
          ],
          "expect": {
            "returns": null
          },
          "note": "JavaScript's own test: should return null for whitespace only"
        }
      ]
    },
    {
      "id": "state.getRegions",
      "level": "extended",
      "summary": "Gets the five Brazilian regions (Grandes Regiões) with their codes and IBGE identifiers.",
      "description": "Returns the five Grandes Regiões of the IBGE, sorted by their IBGE identifier: Norte (1), Nordeste (2), Sudeste (3), Sul (4) and Centro-Oeste (5).\n\n- Each entry has the region code (`N`, `NE`, `SE`, `S`, `CO`, the same `regionCode` every state carries), the name and the IBGE identifier.\n- The `State` type has no region identifier field. The identifier comes only from this function.\n- Each call returns a new array of new objects.",
      "params": [],
      "returns": "Region[]",
      "cases": [
        {
          "id": "state.getRegions#all-regions",
          "args": [],
          "expect": {
            "returns": [
              {
                "code": "N",
                "name": "Norte",
                "ibgeCode": 1
              },
              {
                "code": "NE",
                "name": "Nordeste",
                "ibgeCode": 2
              },
              {
                "code": "SE",
                "name": "Sudeste",
                "ibgeCode": 3
              },
              {
                "code": "S",
                "name": "Sul",
                "ibgeCode": 4
              },
              {
                "code": "CO",
                "name": "Centro-Oeste",
                "ibgeCode": 5
              }
            ]
          },
          "note": "JavaScript's own test: should return the five regions in the order of their IBGE identifier"
        }
      ]
    },
    {
      "id": "state.getTimezone",
      "level": "extended",
      "summary": "Gets the IANA time zone database name (tzdata zone) for a Brazilian state.",
      "description": "Returns the IANA time zone (tzdata zone) of a state: the zone of its capital, such as `America/Sao_Paulo`.\n\n- Some states straddle more than one zone, and the capital's zone says nothing about the rest. The west of Amazonas (`America/Eirunepe`, UTC-5) and the west of Pará (`America/Santarem`, UTC-3) are not represented, and Fernando de Noronha (`America/Noronha`, UTC-2), a district of Pernambuco, resolves as Recife (`America/Recife`, UTC-3).\n- The offsets follow the capitals: Acre UTC-5; Amazonas, Roraima, Rondônia, Mato Grosso and Mato Grosso do Sul UTC-4; the other states UTC-3. One tzdata zone can serve several states (`America/Sao_Paulo` also covers DF, GO, MG, ES, RJ, PR, SC and RS, and `America/Fortaleza` also covers MA, PI, RN and PB besides CE).\n- The match ignores case and surrounding whitespace.\n- Returns `null` when no state matches.",
      "params": [
        {
          "name": "stateCode",
          "type": "string"
        }
      ],
      "returns": "string?",
      "cases": [
        {
          "id": "state.getTimezone#[\"SP\"]",
          "args": [
            "SP"
          ],
          "expect": {
            "returns": "America/Sao_Paulo"
          }
        },
        {
          "id": "state.getTimezone#[\"AM\"]",
          "args": [
            "AM"
          ],
          "expect": {
            "returns": "America/Manaus"
          }
        },
        {
          "id": "state.getTimezone#[\"AC\"]",
          "args": [
            "AC"
          ],
          "expect": {
            "returns": "America/Rio_Branco"
          }
        },
        {
          "id": "state.getTimezone#[\"BA\"]",
          "args": [
            "BA"
          ],
          "expect": {
            "returns": "America/Bahia"
          }
        },
        {
          "id": "state.getTimezone#lowercase",
          "args": [
            "sp"
          ],
          "expect": {
            "returns": "America/Sao_Paulo"
          }
        },
        {
          "id": "state.getTimezone#padded",
          "args": [
            "  SP  "
          ],
          "expect": {
            "returns": "America/Sao_Paulo"
          }
        },
        {
          "id": "state.getTimezone#[\"ZZ\"]",
          "args": [
            "ZZ"
          ],
          "expect": {
            "returns": null
          }
        },
        {
          "id": "state.getTimezone#empty",
          "args": [
            ""
          ],
          "expect": {
            "returns": null
          }
        },
        {
          "id": "state.getTimezone#[\"PE\"]",
          "args": [
            "PE"
          ],
          "expect": {
            "returns": "America/Recife"
          },
          "note": "JavaScript's own test: should return America/Recife for PE, not America/Noronha (Fernando de Noronha is a district of PE, not a state)"
        },
        {
          "id": "state.getTimezone#[\"AP\"]",
          "args": [
            "AP"
          ],
          "expect": {
            "returns": "America/Belem"
          },
          "note": "JavaScript's own test: should return America/Belem for AP, per the tzdata BR row 'Pará (east), Amapá'"
        },
        {
          "id": "state.getTimezone#[\"PA\"]",
          "args": [
            "PA"
          ],
          "expect": {
            "returns": "America/Belem"
          },
          "note": "JavaScript's own test: should return America/Belem for PA"
        },
        {
          "id": "state.getTimezone#[\"CE\"]",
          "args": [
            "CE"
          ],
          "expect": {
            "returns": "America/Fortaleza"
          },
          "note": "JavaScript's own test: should return America/Fortaleza for CE, MA, PI, RN and PB, the tzdata BR row 'Brazil (northeast: MA, PI, CE, RN, PB)'"
        },
        {
          "id": "state.getTimezone#[\"MA\"]",
          "args": [
            "MA"
          ],
          "expect": {
            "returns": "America/Fortaleza"
          },
          "note": "JavaScript's own test: should return America/Fortaleza for CE, MA, PI, RN and PB, the tzdata BR row 'Brazil (northeast: MA, PI, CE, RN, PB)'"
        },
        {
          "id": "state.getTimezone#[\"PI\"]",
          "args": [
            "PI"
          ],
          "expect": {
            "returns": "America/Fortaleza"
          },
          "note": "JavaScript's own test: should return America/Fortaleza for CE, MA, PI, RN and PB, the tzdata BR row 'Brazil (northeast: MA, PI, CE, RN, PB)'"
        },
        {
          "id": "state.getTimezone#[\"RN\"]",
          "args": [
            "RN"
          ],
          "expect": {
            "returns": "America/Fortaleza"
          },
          "note": "JavaScript's own test: should return America/Fortaleza for CE, MA, PI, RN and PB, the tzdata BR row 'Brazil (northeast: MA, PI, CE, RN, PB)'"
        },
        {
          "id": "state.getTimezone#[\"PB\"]",
          "args": [
            "PB"
          ],
          "expect": {
            "returns": "America/Fortaleza"
          },
          "note": "JavaScript's own test: should return America/Fortaleza for CE, MA, PI, RN and PB, the tzdata BR row 'Brazil (northeast: MA, PI, CE, RN, PB)'"
        },
        {
          "id": "state.getTimezone#[\"DF\"]",
          "args": [
            "DF"
          ],
          "expect": {
            "returns": "America/Sao_Paulo"
          },
          "note": "JavaScript's own test: should return America/Sao_Paulo for every southeast/south/center-west state sharing that zone"
        },
        {
          "id": "state.getTimezone#[\"GO\"]",
          "args": [
            "GO"
          ],
          "expect": {
            "returns": "America/Sao_Paulo"
          },
          "note": "JavaScript's own test: should return America/Sao_Paulo for every southeast/south/center-west state sharing that zone"
        },
        {
          "id": "state.getTimezone#[\"MG\"]",
          "args": [
            "MG"
          ],
          "expect": {
            "returns": "America/Sao_Paulo"
          },
          "note": "JavaScript's own test: should return America/Sao_Paulo for every southeast/south/center-west state sharing that zone"
        },
        {
          "id": "state.getTimezone#[\"ES\"]",
          "args": [
            "ES"
          ],
          "expect": {
            "returns": "America/Sao_Paulo"
          },
          "note": "JavaScript's own test: should return America/Sao_Paulo for every southeast/south/center-west state sharing that zone"
        },
        {
          "id": "state.getTimezone#[\"RJ\"]",
          "args": [
            "RJ"
          ],
          "expect": {
            "returns": "America/Sao_Paulo"
          },
          "note": "JavaScript's own test: should return America/Sao_Paulo for every southeast/south/center-west state sharing that zone"
        },
        {
          "id": "state.getTimezone#[\"PR\"]",
          "args": [
            "PR"
          ],
          "expect": {
            "returns": "America/Sao_Paulo"
          },
          "note": "JavaScript's own test: should return America/Sao_Paulo for every southeast/south/center-west state sharing that zone"
        },
        {
          "id": "state.getTimezone#[\"SC\"]",
          "args": [
            "SC"
          ],
          "expect": {
            "returns": "America/Sao_Paulo"
          },
          "note": "JavaScript's own test: should return America/Sao_Paulo for every southeast/south/center-west state sharing that zone"
        },
        {
          "id": "state.getTimezone#[\"RS\"]",
          "args": [
            "RS"
          ],
          "expect": {
            "returns": "America/Sao_Paulo"
          },
          "note": "JavaScript's own test: should return America/Sao_Paulo for every southeast/south/center-west state sharing that zone"
        },
        {
          "id": "state.getTimezone#[\"AL\"]",
          "args": [
            "AL"
          ],
          "expect": {
            "returns": "America/Maceio"
          },
          "note": "JavaScript's own test: should return America/Maceio for AL and SE"
        },
        {
          "id": "state.getTimezone#[\"SE\"]",
          "args": [
            "SE"
          ],
          "expect": {
            "returns": "America/Maceio"
          },
          "note": "JavaScript's own test: should return America/Maceio for AL and SE"
        },
        {
          "id": "state.getTimezone#[\"MT\"]",
          "args": [
            "MT"
          ],
          "expect": {
            "returns": "America/Cuiaba"
          },
          "note": "JavaScript's own test: should return America/Cuiaba for MT"
        },
        {
          "id": "state.getTimezone#[\"MS\"]",
          "args": [
            "MS"
          ],
          "expect": {
            "returns": "America/Campo_Grande"
          },
          "note": "JavaScript's own test: should return America/Campo_Grande for MS"
        },
        {
          "id": "state.getTimezone#[\"RO\"]",
          "args": [
            "RO"
          ],
          "expect": {
            "returns": "America/Porto_Velho"
          },
          "note": "JavaScript's own test: should return America/Porto_Velho for RO"
        },
        {
          "id": "state.getTimezone#[\"RR\"]",
          "args": [
            "RR"
          ],
          "expect": {
            "returns": "America/Boa_Vista"
          },
          "note": "JavaScript's own test: should return America/Boa_Vista for RR"
        },
        {
          "id": "state.getTimezone#[\"TO\"]",
          "args": [
            "TO"
          ],
          "expect": {
            "returns": "America/Araguaina"
          },
          "note": "JavaScript's own test: should return America/Araguaina for TO"
        },
        {
          "id": "state.getTimezone#[\"constructor\"]",
          "args": [
            "constructor"
          ],
          "expect": {
            "returns": null
          },
          "note": "JavaScript's own test: should return null for names inherited from Object.prototype"
        },
        {
          "id": "state.getTimezone#[\"toString\"]",
          "args": [
            "toString"
          ],
          "expect": {
            "returns": null
          },
          "note": "JavaScript's own test: should return null for names inherited from Object.prototype"
        },
        {
          "id": "state.getTimezone#[\"__proto__\"]",
          "args": [
            "__proto__"
          ],
          "expect": {
            "returns": null
          },
          "note": "JavaScript's own test: should return null for names inherited from Object.prototype"
        },
        {
          "id": "state.getTimezone#[\"am\"]",
          "args": [
            "am"
          ],
          "expect": {
            "returns": "America/Manaus"
          },
          "note": "JavaScript docs example"
        }
      ]
    },
    {
      "id": "state.list",
      "level": "extended",
      "summary": "Gets a list of all Brazilian states with their codes and names.",
      "description": "Returns the 27 Brazilian federative units, sorted by name (pt-BR collation).\n\n- Each entry has the two-letter code, the name, the region code and name, and the 2-digit IBGE code.\n- Each call returns a new array of new objects.",
      "params": [],
      "returns": "State[]",
      "cases": [
        {
          "id": "state.list#all-states",
          "args": [],
          "expect": {
            "returns": [
              {
                "code": "AC",
                "name": "Acre",
                "regionCode": "N",
                "regionName": "Norte",
                "ibgeCode": 12
              },
              {
                "code": "AL",
                "name": "Alagoas",
                "regionCode": "NE",
                "regionName": "Nordeste",
                "ibgeCode": 27
              },
              {
                "code": "AP",
                "name": "Amapá",
                "regionCode": "N",
                "regionName": "Norte",
                "ibgeCode": 16
              },
              {
                "code": "AM",
                "name": "Amazonas",
                "regionCode": "N",
                "regionName": "Norte",
                "ibgeCode": 13
              },
              {
                "code": "BA",
                "name": "Bahia",
                "regionCode": "NE",
                "regionName": "Nordeste",
                "ibgeCode": 29
              },
              {
                "code": "CE",
                "name": "Ceará",
                "regionCode": "NE",
                "regionName": "Nordeste",
                "ibgeCode": 23
              },
              {
                "code": "DF",
                "name": "Distrito Federal",
                "regionCode": "CO",
                "regionName": "Centro-Oeste",
                "ibgeCode": 53
              },
              {
                "code": "ES",
                "name": "Espírito Santo",
                "regionCode": "SE",
                "regionName": "Sudeste",
                "ibgeCode": 32
              },
              {
                "code": "GO",
                "name": "Goiás",
                "regionCode": "CO",
                "regionName": "Centro-Oeste",
                "ibgeCode": 52
              },
              {
                "code": "MA",
                "name": "Maranhão",
                "regionCode": "NE",
                "regionName": "Nordeste",
                "ibgeCode": 21
              },
              {
                "code": "MT",
                "name": "Mato Grosso",
                "regionCode": "CO",
                "regionName": "Centro-Oeste",
                "ibgeCode": 51
              },
              {
                "code": "MS",
                "name": "Mato Grosso do Sul",
                "regionCode": "CO",
                "regionName": "Centro-Oeste",
                "ibgeCode": 50
              },
              {
                "code": "MG",
                "name": "Minas Gerais",
                "regionCode": "SE",
                "regionName": "Sudeste",
                "ibgeCode": 31
              },
              {
                "code": "PA",
                "name": "Pará",
                "regionCode": "N",
                "regionName": "Norte",
                "ibgeCode": 15
              },
              {
                "code": "PB",
                "name": "Paraíba",
                "regionCode": "NE",
                "regionName": "Nordeste",
                "ibgeCode": 25
              },
              {
                "code": "PR",
                "name": "Paraná",
                "regionCode": "S",
                "regionName": "Sul",
                "ibgeCode": 41
              },
              {
                "code": "PE",
                "name": "Pernambuco",
                "regionCode": "NE",
                "regionName": "Nordeste",
                "ibgeCode": 26
              },
              {
                "code": "PI",
                "name": "Piauí",
                "regionCode": "NE",
                "regionName": "Nordeste",
                "ibgeCode": 22
              },
              {
                "code": "RJ",
                "name": "Rio de Janeiro",
                "regionCode": "SE",
                "regionName": "Sudeste",
                "ibgeCode": 33
              },
              {
                "code": "RN",
                "name": "Rio Grande do Norte",
                "regionCode": "NE",
                "regionName": "Nordeste",
                "ibgeCode": 24
              },
              {
                "code": "RS",
                "name": "Rio Grande do Sul",
                "regionCode": "S",
                "regionName": "Sul",
                "ibgeCode": 43
              },
              {
                "code": "RO",
                "name": "Rondônia",
                "regionCode": "N",
                "regionName": "Norte",
                "ibgeCode": 11
              },
              {
                "code": "RR",
                "name": "Roraima",
                "regionCode": "N",
                "regionName": "Norte",
                "ibgeCode": 14
              },
              {
                "code": "SC",
                "name": "Santa Catarina",
                "regionCode": "S",
                "regionName": "Sul",
                "ibgeCode": 42
              },
              {
                "code": "SP",
                "name": "São Paulo",
                "regionCode": "SE",
                "regionName": "Sudeste",
                "ibgeCode": 35
              },
              {
                "code": "SE",
                "name": "Sergipe",
                "regionCode": "NE",
                "regionName": "Nordeste",
                "ibgeCode": 28
              },
              {
                "code": "TO",
                "name": "Tocantins",
                "regionCode": "N",
                "regionName": "Norte",
                "ibgeCode": 17
              }
            ]
          },
          "note": "27 federative units sorted by name, as held by the reference"
        }
      ]
    },
    {
      "id": "state.listByRegion",
      "level": "extended",
      "summary": "Gets the Brazilian states of a region (Grande Região).",
      "description": "Returns the states of a region, given its code: `N`, `NE`, `SE`, `S` or `CO`.\n\n- The match ignores case and surrounding whitespace: `\"co\"` and `\" CO \"` give the same list.\n- The states come sorted by name, as in `state.list`, with the same fields.\n- Returns an empty list for an unknown code (a region name such as `Norte` included) and for a value that is not a string.\n- Each call returns a new array of new objects.",
      "params": [
        {
          "name": "regionCode",
          "type": "string"
        }
      ],
      "returns": "State[]",
      "cases": [
        {
          "id": "state.listByRegion#[\"co\"]",
          "args": [
            "co"
          ],
          "expect": {
            "returns": [
              {
                "code": "DF",
                "name": "Distrito Federal",
                "regionCode": "CO",
                "regionName": "Centro-Oeste",
                "ibgeCode": 53
              },
              {
                "code": "GO",
                "name": "Goiás",
                "regionCode": "CO",
                "regionName": "Centro-Oeste",
                "ibgeCode": 52
              },
              {
                "code": "MT",
                "name": "Mato Grosso",
                "regionCode": "CO",
                "regionName": "Centro-Oeste",
                "ibgeCode": 51
              },
              {
                "code": "MS",
                "name": "Mato Grosso do Sul",
                "regionCode": "CO",
                "regionName": "Centro-Oeste",
                "ibgeCode": 50
              }
            ]
          },
          "note": "from the maintainer briefing, #601"
        },
        {
          "id": "state.listByRegion#[\"X\"]",
          "args": [
            "X"
          ],
          "expect": {
            "returns": []
          },
          "note": "from the maintainer briefing, #601"
        },
        {
          "id": "state.listByRegion#[\"N\"]",
          "args": [
            "N"
          ],
          "expect": {
            "returns": [
              {
                "code": "AC",
                "name": "Acre",
                "regionCode": "N",
                "regionName": "Norte",
                "ibgeCode": 12
              },
              {
                "code": "AP",
                "name": "Amapá",
                "regionCode": "N",
                "regionName": "Norte",
                "ibgeCode": 16
              },
              {
                "code": "AM",
                "name": "Amazonas",
                "regionCode": "N",
                "regionName": "Norte",
                "ibgeCode": 13
              },
              {
                "code": "PA",
                "name": "Pará",
                "regionCode": "N",
                "regionName": "Norte",
                "ibgeCode": 15
              },
              {
                "code": "RO",
                "name": "Rondônia",
                "regionCode": "N",
                "regionName": "Norte",
                "ibgeCode": 11
              },
              {
                "code": "RR",
                "name": "Roraima",
                "regionCode": "N",
                "regionName": "Norte",
                "ibgeCode": 14
              },
              {
                "code": "TO",
                "name": "Tocantins",
                "regionCode": "N",
                "regionName": "Norte",
                "ibgeCode": 17
              }
            ]
          },
          "note": "JavaScript's own test: should list the states of each region, sorted by name"
        },
        {
          "id": "state.listByRegion#[\"NE\"]",
          "args": [
            "NE"
          ],
          "expect": {
            "returns": [
              {
                "code": "AL",
                "name": "Alagoas",
                "regionCode": "NE",
                "regionName": "Nordeste",
                "ibgeCode": 27
              },
              {
                "code": "BA",
                "name": "Bahia",
                "regionCode": "NE",
                "regionName": "Nordeste",
                "ibgeCode": 29
              },
              {
                "code": "CE",
                "name": "Ceará",
                "regionCode": "NE",
                "regionName": "Nordeste",
                "ibgeCode": 23
              },
              {
                "code": "MA",
                "name": "Maranhão",
                "regionCode": "NE",
                "regionName": "Nordeste",
                "ibgeCode": 21
              },
              {
                "code": "PB",
                "name": "Paraíba",
                "regionCode": "NE",
                "regionName": "Nordeste",
                "ibgeCode": 25
              },
              {
                "code": "PE",
                "name": "Pernambuco",
                "regionCode": "NE",
                "regionName": "Nordeste",
                "ibgeCode": 26
              },
              {
                "code": "PI",
                "name": "Piauí",
                "regionCode": "NE",
                "regionName": "Nordeste",
                "ibgeCode": 22
              },
              {
                "code": "RN",
                "name": "Rio Grande do Norte",
                "regionCode": "NE",
                "regionName": "Nordeste",
                "ibgeCode": 24
              },
              {
                "code": "SE",
                "name": "Sergipe",
                "regionCode": "NE",
                "regionName": "Nordeste",
                "ibgeCode": 28
              }
            ]
          },
          "note": "JavaScript's own test: should list the states of each region, sorted by name"
        },
        {
          "id": "state.listByRegion#[\"SE\"]",
          "args": [
            "SE"
          ],
          "expect": {
            "returns": [
              {
                "code": "ES",
                "name": "Espírito Santo",
                "regionCode": "SE",
                "regionName": "Sudeste",
                "ibgeCode": 32
              },
              {
                "code": "MG",
                "name": "Minas Gerais",
                "regionCode": "SE",
                "regionName": "Sudeste",
                "ibgeCode": 31
              },
              {
                "code": "RJ",
                "name": "Rio de Janeiro",
                "regionCode": "SE",
                "regionName": "Sudeste",
                "ibgeCode": 33
              },
              {
                "code": "SP",
                "name": "São Paulo",
                "regionCode": "SE",
                "regionName": "Sudeste",
                "ibgeCode": 35
              }
            ]
          },
          "note": "JavaScript's own test: should list the states of each region, sorted by name"
        },
        {
          "id": "state.listByRegion#[\"S\"]",
          "args": [
            "S"
          ],
          "expect": {
            "returns": [
              {
                "code": "PR",
                "name": "Paraná",
                "regionCode": "S",
                "regionName": "Sul",
                "ibgeCode": 41
              },
              {
                "code": "RS",
                "name": "Rio Grande do Sul",
                "regionCode": "S",
                "regionName": "Sul",
                "ibgeCode": 43
              },
              {
                "code": "SC",
                "name": "Santa Catarina",
                "regionCode": "S",
                "regionName": "Sul",
                "ibgeCode": 42
              }
            ]
          },
          "note": "JavaScript's own test: should list the states of each region, sorted by name"
        },
        {
          "id": "state.listByRegion#[\"CO\"]",
          "args": [
            "CO"
          ],
          "expect": {
            "returns": [
              {
                "code": "DF",
                "name": "Distrito Federal",
                "regionCode": "CO",
                "regionName": "Centro-Oeste",
                "ibgeCode": 53
              },
              {
                "code": "GO",
                "name": "Goiás",
                "regionCode": "CO",
                "regionName": "Centro-Oeste",
                "ibgeCode": 52
              },
              {
                "code": "MT",
                "name": "Mato Grosso",
                "regionCode": "CO",
                "regionName": "Centro-Oeste",
                "ibgeCode": 51
              },
              {
                "code": "MS",
                "name": "Mato Grosso do Sul",
                "regionCode": "CO",
                "regionName": "Centro-Oeste",
                "ibgeCode": 50
              }
            ]
          },
          "note": "JavaScript's own test: should list the states of each region, sorted by name"
        },
        {
          "id": "state.listByRegion#[\" co \"]",
          "args": [
            " co "
          ],
          "expect": {
            "returns": [
              {
                "code": "DF",
                "name": "Distrito Federal",
                "regionCode": "CO",
                "regionName": "Centro-Oeste",
                "ibgeCode": 53
              },
              {
                "code": "GO",
                "name": "Goiás",
                "regionCode": "CO",
                "regionName": "Centro-Oeste",
                "ibgeCode": 52
              },
              {
                "code": "MT",
                "name": "Mato Grosso",
                "regionCode": "CO",
                "regionName": "Centro-Oeste",
                "ibgeCode": 51
              },
              {
                "code": "MS",
                "name": "Mato Grosso do Sul",
                "regionCode": "CO",
                "regionName": "Centro-Oeste",
                "ibgeCode": 50
              }
            ]
          },
          "note": "JavaScript's own test: should ignore case and surrounding whitespace"
        },
        {
          "id": "state.listByRegion#[\"s\"]",
          "args": [
            "s"
          ],
          "expect": {
            "returns": [
              {
                "code": "PR",
                "name": "Paraná",
                "regionCode": "S",
                "regionName": "Sul",
                "ibgeCode": 41
              },
              {
                "code": "RS",
                "name": "Rio Grande do Sul",
                "regionCode": "S",
                "regionName": "Sul",
                "ibgeCode": 43
              },
              {
                "code": "SC",
                "name": "Santa Catarina",
                "regionCode": "S",
                "regionName": "Sul",
                "ibgeCode": 42
              }
            ]
          }
        },
        {
          "id": "state.listByRegion#empty",
          "args": [
            ""
          ],
          "expect": {
            "returns": []
          },
          "note": "JavaScript's own test: should return an empty array for an unknown region code"
        },
        {
          "id": "state.listByRegion#[\"Norte\"]",
          "args": [
            "Norte"
          ],
          "expect": {
            "returns": []
          },
          "note": "JavaScript's own test: should return an empty array for an unknown region code"
        },
        {
          "id": "state.listByRegion#[\"C O\"]",
          "args": [
            "C O"
          ],
          "expect": {
            "returns": []
          }
        },
        {
          "id": "state.listByRegion#[\"constructor\"]",
          "args": [
            "constructor"
          ],
          "expect": {
            "returns": []
          }
        },
        {
          "id": "state.listByRegion#[1]",
          "args": [
            1
          ],
          "expect": {
            "returns": []
          },
          "note": "JavaScript's own test: should return an empty array for a value that is not a string"
        }
      ]
    }
  ]
}
