Files
regorus/tests/interpreter/cases/builtins/numbers/round.yaml
Anand Krishnamoorthi 6b87e99fb9 Tests for numbers builtins
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
2023-02-28 09:38:40 +05:30

37 lines
766 B
YAML

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
cases:
- note: round
data: {}
modules:
- |
package test
x = [round(-9.4), round(-9.5), round(-9.6),
round(9.4), round(9.5), round(9.6),
round(8), round(-8)]
# Undefined
y { false }
z = round(y)
query: data.test.x
want_result: [-9, -10, -10, 9, 10, 10, 8, -8]
- note: extra-args
data: {}
modules:
- |
package test
x = round(-9, 10)
query: data.test.x
error: "`round` expects 1 argument"
- note: invalid-type
data: {}
modules:
- |
package test
x = round("-9")
query: data.test.x
error: "`round` expects numeric argument"