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

36 lines
661 B
YAML

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