mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
Number is implemented using rust_decimal::Decimal which uses a 96 bit mantissa. TODO: a) Support u64, i64 variants b) Determine desired semantics for floating-point c) Determine desired big integer length d) Explore other big int/big float crates Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
65 lines
1.1 KiB
YAML
65 lines
1.1 KiB
YAML
# Copyright (c) Microsoft Corporation.
|
|
# Licensed under the MIT License.
|
|
|
|
cases:
|
|
- note: mod
|
|
data: {}
|
|
modules:
|
|
- |
|
|
package test
|
|
x = 10%3
|
|
|
|
# Undefined
|
|
y { false }
|
|
b = y % 1
|
|
c = 1 % y
|
|
query: data.test
|
|
want_result:
|
|
x : 1
|
|
|
|
- note: non-numeric
|
|
data: {}
|
|
modules:
|
|
- |
|
|
package test
|
|
x = "1" % 9
|
|
query: data.test.x
|
|
error: "`mod` expects numeric argument."
|
|
|
|
- note: undefined
|
|
data: {}
|
|
modules:
|
|
- |
|
|
package test
|
|
a { false }
|
|
x = a % 10
|
|
query: data.test
|
|
want_result: {}
|
|
|
|
- note: by-zero
|
|
data: {}
|
|
modules:
|
|
- |
|
|
package test
|
|
x = 1%0
|
|
query: data.test
|
|
error: modulo by zero
|
|
|
|
- note: float numerator
|
|
data: {}
|
|
modules:
|
|
- |
|
|
package test
|
|
x = 1.1 % 1
|
|
query: data.test
|
|
error: modulo on floating-point number
|
|
|
|
- note: float denom
|
|
data: {}
|
|
modules:
|
|
- |
|
|
package test
|
|
x = 1 % 1.1
|
|
query: data.test
|
|
error: modulo on floating-point number
|