mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
Code from github.com/anakrish/rego-rs
Authored by anakrish and mingweishih Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
cases:
|
||||
- note: basic
|
||||
data: {}
|
||||
modules:
|
||||
- |
|
||||
package test
|
||||
|
||||
inc(x) = x + 1
|
||||
|
||||
a1 = inc(5)
|
||||
query: data.test
|
||||
want_result:
|
||||
a1: 6
|
||||
|
||||
- note: call-in-arg
|
||||
data: {}
|
||||
modules:
|
||||
- |
|
||||
package test
|
||||
|
||||
inc(x) = x + 1
|
||||
|
||||
a1 = inc(inc(5))
|
||||
query: data.test
|
||||
want_result:
|
||||
a1: 7
|
||||
|
||||
- note: call-nested
|
||||
data: {}
|
||||
modules:
|
||||
- |
|
||||
package test
|
||||
|
||||
sub(a, b) := a - b
|
||||
|
||||
foo(a, b) := r {
|
||||
r =(a + b) * sub(a, b)
|
||||
}
|
||||
|
||||
a = foo(5, 6)
|
||||
query: data.test
|
||||
want_result:
|
||||
a: -11
|
||||
|
||||
Reference in New Issue
Block a user