{
  "$schema": "https://raw.githubusercontent.com/unicode-org/message-format-wg/main/test/schemas/v0/tests.schema.json",
  "scenario": "Number function",
  "description": "The built-in formatter for numbers.",
  "defaultTestProperties": {
    "bidiIsolation": "none",
    "locale": "en-US"
  },
  "tests": [
    {
      "src": "hello {4.2 :number}",
      "exp": "hello 4.2"
    },
    {
      "src": "hello {-4.20 :number}",
      "exp": "hello -4.2"
    },
    {
      "src": "hello {0.42e+1 :number}",
      "exp": "hello 4.2"
    },
    {
      "src": "hello {foo :number}",
      "exp": "hello {|foo|}",
      "expErrors": [
        {
          "type": "bad-operand"
        }
      ]
    },
    {
      "src": "invalid number literal {|.1| :number}",
      "exp": "invalid number literal {|.1|}",
      "expErrors": [
        {
          "type": "bad-operand"
        }
      ]
    },
    {
      "src": "invalid number literal {|1.| :number}",
      "exp": "invalid number literal {|1.|}",
      "expErrors": [
        {
          "type": "bad-operand"
        }
      ]
    },
    {
      "src": "invalid number literal {|01| :number}",
      "exp": "invalid number literal {|01|}",
      "expErrors": [
        {
          "type": "bad-operand"
        }
      ]
    },
    {
      "src": "invalid number literal {|+1| :number}",
      "exp": "invalid number literal {|+1|}",
      "expErrors": [
        {
          "type": "bad-operand"
        }
      ]
    },
    {
      "src": "invalid number literal {|0x1| :number}",
      "exp": "invalid number literal {|0x1|}",
      "expErrors": [
        {
          "type": "bad-operand"
        }
      ]
    },
    {
      "src": "hello {:number}",
      "exp": "hello {:number}",
      "expErrors": [
        {
          "type": "bad-operand"
        }
      ]
    },
    {
      "src": "hello {4.2 :number minimumFractionDigits=2}",
      "exp": "hello 4.20"
    },
    {
      "src": "hello {|4.2| :number minimumFractionDigits=|2|}",
      "exp": "hello 4.20"
    },
    {
      "src": "hello {4.2 :number minimumFractionDigits=$foo}",
      "params": [
        {
          "name": "foo",
          "value": 2
        }
      ],
      "exp": "hello 4.20"
    },
    {
      "src": "hello {|4.2| :number minimumFractionDigits=$foo}",
      "params": [
        {
          "name": "foo",
          "value": "2"
        }
      ],
      "exp": "hello 4.20"
    },
    {
      "src": ".local $foo = {$bar :number} {{bar {$foo}}}",
      "params": [
        {
          "name": "bar",
          "value": 4.2
        }
      ],
      "exp": "bar 4.2"
    },
    {
      "src": ".local $foo = {$bar :number minimumFractionDigits=2} {{bar {$foo}}}",
      "params": [
        {
          "name": "bar",
          "value": 4.2
        }
      ],
      "exp": "bar 4.20"
    },
    {
      "src": ".local $foo = {$bar :number minimumFractionDigits=foo} {{bar {$foo}}}",
      "params": [{ "name": "bar", "value": 4.2 }],
      "expErrors": [{ "type": "bad-option" }]
    },
    {
      "src": ".local $foo = {$bar :number} {{bar {$foo}}}",
      "params": [{ "name": "bar", "value": "foo" }],
      "exp": "bar {$foo}",
      "expErrors": [{ "type": "bad-operand" }]
    },
    {
      "src": ".input {$foo :number} {{bar {$foo}}}",
      "params": [
        {
          "name": "foo",
          "value": 4.2
        }
      ],
      "exp": "bar 4.2"
    },
    {
      "src": ".input {$foo :number minimumFractionDigits=2} {{bar {$foo}}}",
      "params": [
        {
          "name": "foo",
          "value": 4.2
        }
      ],
      "exp": "bar 4.20"
    },
    {
      "src": ".input {$foo :number minimumFractionDigits=foo} {{bar {$foo}}}",
      "params": [{ "name": "foo", "value": 4.2 }],
      "expErrors": [{ "type": "bad-option" }]
    },
    {
      "src": ".input {$foo :number} {{bar {$foo}}}",
      "params": [
        {
          "name": "foo",
          "value": "foo"
        }
      ],
      "exp": "bar {$foo}",
      "expErrors": [
        {
          "type": "bad-operand"
        }
      ]
    },
    {
      "src": "{42 :number @foo @bar=13}",
      "exp": "42",
      "expParts": [
        {
          "type": "number",
          "source": "|42|",
          "parts": [
            {
              "type": "integer",
              "value": "42"
            }
          ]
        }
      ]
    }
  ]
}
