Skip to content

Commit

Permalink
test/cases: add test case for rand.intn (open-policy-agent#5207)
Browse files Browse the repository at this point in the history
It looks like we didn't have any before. While it's inherently random, we still
know that for the same inputs, within a single evaluation run, we should only
get one output. So let's assert that.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
Signed-off-by: Byron Lagrone <byron.lagrone@seqster.com>
  • Loading branch information
srenatus authored and byronic committed Oct 17, 2022
1 parent 57668fe commit ec9d85b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/cases/testdata/rand/test-rand.intn.yaml
@@ -0,0 +1,13 @@
cases:
- data:
modules:
- |
package test
p = count(rands) {
rands := { rand.intn("key", 100) | numbers.range(1,100)[_] }
}
note: rand.intn/consistent values for same arguments
query: data.test.p = x
want_result:
- x: 1

0 comments on commit ec9d85b

Please sign in to comment.