{
  "$schema": "../cases.schema.json",
  "format": 1,
  "domain": "csosn",
  "title": {
    "en": "CSOSN",
    "pt-BR": "CSOSN"
  },
  "functions": [
    {
      "id": "csosn.isValid",
      "level": "extended",
      "summary": "Checks whether a CSOSN code is valid.",
      "description": "Checks whether a CSOSN is one of the 10 codes of the official table: `101`, `102`, `103`, `201`, `202`, `203`, `300`, `400`, `500`, `900`.\n\n- Accepts the bare 3 digits as a string, or a non-negative integer. A CSOSN has no printed grouping, so the function rejects a masked value.\n- Surrounding whitespace is ignored. Any other string is rejected: the function does not pick out its digits (`\"abc101\"`).\n- Nothing is padded: no code starts with a zero, so a value narrower than 3 digits is not a code. A number is read only when it is a safe non-negative integer.\n- No behavior change in 2.5.0.\n- Source: Anexo III-A of Convênio SINIEF s/nº 1970 (table instituted by Ajuste SINIEF 03/2010).",
      "params": [
        {
          "name": "value",
          "type": "string | number"
        }
      ],
      "returns": "boolean",
      "cases": [
        {
          "id": "csosn.isValid#[\"101\"]",
          "args": [
            "101"
          ],
          "expect": {
            "returns": true
          }
        },
        {
          "id": "csosn.isValid#[\"102\"]",
          "args": [
            "102"
          ],
          "expect": {
            "returns": true
          }
        },
        {
          "id": "csosn.isValid#nonexistent",
          "args": [
            "999"
          ],
          "expect": {
            "returns": false
          }
        },
        {
          "id": "csosn.isValid#too-short",
          "args": [
            "10"
          ],
          "expect": {
            "returns": false
          }
        },
        {
          "id": "csosn.isValid#separator",
          "args": [
            "1-01"
          ],
          "expect": {
            "returns": false
          }
        },
        {
          "id": "csosn.isValid#letters",
          "args": [
            "abc"
          ],
          "expect": {
            "returns": false
          }
        },
        {
          "id": "csosn.isValid#empty",
          "args": [
            ""
          ],
          "expect": {
            "returns": false
          }
        },
        {
          "id": "csosn.isValid#[101]",
          "args": [
            101
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for a number input"
        },
        {
          "id": "csosn.isValid#[\" 101 \"]",
          "args": [
            " 101 "
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true with surrounding whitespace"
        },
        {
          "id": "csosn.isValid#[\"1010\"]",
          "args": [
            "1010"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false for a length different from 3"
        },
        {
          "id": "csosn.isValid#[\"abc101\"]",
          "args": [
            "abc101"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false for a string that is not a documented form"
        },
        {
          "id": "csosn.isValid#[\"1--01\"]",
          "args": [
            "1--01"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false for a string that is not a documented form"
        },
        {
          "id": "csosn.isValid#[\"1 01\"]",
          "args": [
            "1 01"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false for a code split by a separator, since a CSOSN has no printed grouping"
        },
        {
          "id": "csosn.isValid#[\"10.1\"]",
          "args": [
            "10.1"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false for a code split by a separator, since a CSOSN has no printed grouping"
        },
        {
          "id": "csosn.isValid#[\"1-0-1\"]",
          "args": [
            "1-0-1"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false for a code split by a separator, since a CSOSN has no printed grouping"
        },
        {
          "id": "csosn.isValid#[-101]",
          "args": [
            -101
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false for a number that is not a non-negative safe integer"
        },
        {
          "id": "csosn.isValid#[10.1]",
          "args": [
            10.1
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false for a number that is not a non-negative safe integer"
        },
        {
          "id": "csosn.isValid#[\"103\"]",
          "args": [
            "103"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for every known CSOSN code"
        },
        {
          "id": "csosn.isValid#[\"201\"]",
          "args": [
            "201"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for every known CSOSN code"
        },
        {
          "id": "csosn.isValid#[\"202\"]",
          "args": [
            "202"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for every known CSOSN code"
        },
        {
          "id": "csosn.isValid#[\"203\"]",
          "args": [
            "203"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for every known CSOSN code"
        },
        {
          "id": "csosn.isValid#[\"300\"]",
          "args": [
            "300"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for every known CSOSN code"
        },
        {
          "id": "csosn.isValid#[\"400\"]",
          "args": [
            "400"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for every known CSOSN code"
        },
        {
          "id": "csosn.isValid#[\"500\"]",
          "args": [
            "500"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for every known CSOSN code"
        },
        {
          "id": "csosn.isValid#[\"900\"]",
          "args": [
            "900"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for every known CSOSN code"
        },
        {
          "id": "csosn.isValid#[900]",
          "args": [
            900
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript docs example"
        }
      ]
    }
  ]
}
