From 6126c784cbf847f405758b75b3467c2e50fac95b Mon Sep 17 00:00:00 2001 From: "Andrii Doroshenko (Xrayez)" Date: Sun, 20 Feb 2022 21:58:22 +0200 Subject: [PATCH] More test assertions for `Random.pop()` --- tests/project/goost/core/math/test_random.gd | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/project/goost/core/math/test_random.gd b/tests/project/goost/core/math/test_random.gd index e47c9c9e..dde0944a 100644 --- a/tests/project/goost/core/math/test_random.gd +++ b/tests/project/goost/core/math/test_random.gd @@ -246,6 +246,22 @@ func test_pop(): assert_eq(popped[3], 4) popped.clear() + array.clear() + for i in 100: + array.push_back(i) + + while not array.empty(): + var _e = rng.pop(array) + + assert_eq(array.size(), 0) + + Engine.print_error_messages = false + + assert_null(rng.pop([])) + assert_null(rng.pop({})) + + Engine.print_error_messages = true + func test_shuffle_array(): var rng = Random.new_instance()