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

53 lines
1.1 KiB
YAML

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
cases:
- note: all
data: {}
modules:
- |
package test
x = [
max([-1, 3, 2]),
max({1, 2, -1}),
]
r {false}
u1 = max(r)
u2 = max([])
u3 = max(set())
query: data.test
want_result:
x: [ 3, 2 ]
- note: invalid-null
data: {}
modules: ["package test\n x= max(null)"]
query: data.test
error: "`max` requires array/set argument."
- note: invalid-bool
data: {}
modules: ["package test\n x= max(true)"]
query: data.test
error: "`max` requires array/set argument."
- note: invalid-number
data: {}
modules: ["package test\n x= max(5)"]
query: data.test
error: "`max` requires array/set argument."
- note: invalid-string
data: {}
modules: ["package test\n x= max(`abc`)"]
query: data.test
error: "`max` requires array/set argument."
- note: invalid-object
data: {}
modules: ["package test\n x= max({})"]
query: data.test
error: "`max` requires array/set argument."