From 20982c349bb79c8dd46a9a1d44fa3b1143fad7db Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Wed, 5 Oct 2022 12:47:43 +0200 Subject: [PATCH] test/cases: add test case for rand.intn (#5207) 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 --- test/cases/testdata/rand/test-rand.intn.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 test/cases/testdata/rand/test-rand.intn.yaml diff --git a/test/cases/testdata/rand/test-rand.intn.yaml b/test/cases/testdata/rand/test-rand.intn.yaml new file mode 100644 index 0000000000..66834ce696 --- /dev/null +++ b/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