From 940ca2de5a03349053b52c2d2fd474e7ee0629a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Grabarz?= Date: Mon, 10 Jun 2024 15:23:09 +0200 Subject: [PATCH] Reduce probability of non-determinism test randomly failing. (#10135) The standard library vector sampling test happened to fail by random chance of two consecutive samplings being equal. ![image](https://github.com/enso-org/enso/assets/919491/3c9c73a8-51da-468c-a42d-88a99d30ecbf) To prevent that from happening again, the sampled vector and number of samples was increased. Also, the non-determinism test for some reason was actually performed 3 times, giving 3 opportunities for samplings to accidentaly match and fail the test. Removed that outer loop, since one non-equality is plenty enough to pass the test. --- test/Base_Tests/src/Data/Vector_Spec.enso | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/Base_Tests/src/Data/Vector_Spec.enso b/test/Base_Tests/src/Data/Vector_Spec.enso index 41a274fcfe2..1ea40ef3a3d 100644 --- a/test/Base_Tests/src/Data/Vector_Spec.enso +++ b/test/Base_Tests/src/Data/Vector_Spec.enso @@ -674,14 +674,13 @@ type_spec suite_builder name alter = suite_builder.group name group_builder-> alter ["a", "a", "a"] . drop (Sample 100) . should_equal [] suite_builder.group "take/drop Sample non-determinism" group_builder-> - v = 0.up_to 20 . to_vector + v = 0.up_to 60 . to_vector group_builder.specify "sampling should be deterministic when a seed is supplied" <| - v.take (Sample 3 seed=4200000) . should_equal (v.take (Sample 3 seed=4200000)) + v.take (Sample 5 seed=4200000) . should_equal (v.take (Sample 5 seed=4200000)) group_builder.specify "sampling should be non-deterministic when a seed is not supplied" <| - 0.up_to 3 . map _-> - v.take (Sample 3) . should_not_equal (v.take (Sample 3)) + v.take (Sample 5) . should_not_equal (v.take (Sample 5)) group_builder.specify "take/drop should gracefully handle missing constructor arguments" <| Test.expect_panic Type_Error <| [].take "FOO"