---
cases:
  - data:
    modules:
      - |
        package test
        p {
            units.parse("\"100TI\"") == 109951162777600
        }
    note: units_parse/removes quotes and lowercases string
    query: data.test.p = x
    want_result:
      - x: true
  - data:
    modules:
      - |
        package test
        p {
            units.parse("0") == 0
        }
    note: units_parse/zero
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("0.0") == 0
        }
    note: units_parse/zero float
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse(".0") == 0
        }
    note: units_parse/zero bare float
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("12345") == 12345
        }
    note: units_parse/raw number
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("10K") == 10000
        }
    note: units_parse/10 kilo uppercase
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("10KI") == 10240
        }
    note: units_parse/10 Ki uppercase
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("10k") == 10000
        }
    note: units_parse/10 K lowercase
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("10Ki") == 10240
        }
    note: units_parse/10 Ki mixed case
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("200M") == 200000000
        }
    note: units_parse/200 mega
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("300Gi") == 322122547200
        }
    note: units_parse/300 Gi
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("1.1K") == 1100
        }
    note: units_parse/1.1 K floating point
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("1.1Ki") == 1126.4
        }
    note: units_parse/1.1 Ki floating point, not rounded
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse(".5K") == 500
        }
    note: units_parse/.5 K bare floating point
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("100k") == 100000
        }
    note: units_parse/100 kilo as k
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("100K") == 100000
        }
    note: units_parse/100 kilo as K
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("100ki") == 102400
        }
    note: units_parse/100 kibi as ki
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("100Ki") == 102400
        }
    note: units_parse/100 kibi as Ki
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            round(units.parse("100m") * 1000) == 100
        }
    note: units_parse/100 milli as m
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("100M") == 100000000
        }
    note: units_parse/100 mega as M
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("100mi") == 104857600
        }
    note: units_parse/100 mebi as mi
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("100Mi") == 104857600
        }
    note: units_parse/100 mebi as Mi
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("100g") == 100000000000
        }
    note: units_parse/100 giga as g
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("100gi") == 107374182400
        }
    note: units_parse/100 gibi as gi
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("100t") == 100000000000000
        }
    note: units_parse/100 tera as t
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("100T") == 100000000000000
        }
    note: units_parse/100 tera as T
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("100ti") == 109951162777600
        }
    note: units_parse/100 tebi as ti
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("100Ti") == 109951162777600
        }
    note: units_parse/100 tebi as Ti
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("100p") == 100000000000000000
        }
    note: units_parse/100 peta as p
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("100P") == 100000000000000000
        }
    note: units_parse/100 peta as P
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("100pi") == 112589990684262400
        }
    note: units_parse/100 pebi as pi
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("100Pi") == 112589990684262400
        }
    note: units_parse/100 pebi as Pi
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("10e") == 10000000000000000000
        }
    note: units_parse/10 eta as e
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("10E") == 10000000000000000000
        }
    note: units_parse/10 eta as E
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("10ei") == 11529215046068469760
        }
    note: units_parse/10 ebi as ei
    query: data.test.p = x
    want_result:
      - x: true

  - data:
    modules:
      - |
        package test
        p {
            units.parse("10Ei") == 11529215046068469760
        }
    note: units_parse/10 ebi as Ei
    query: data.test.p = x
    want_result:
      - x: true
