diff --git a/tests/unit/helpers/random_string.cpp b/tests/unit/helpers/random_string.cpp index d4c8ca5cd3c2ecd5cbad1947811121039bed2c94..223a70e9e9e3adf82802aedd1be2e730ca8cb879 100644 --- a/tests/unit/helpers/random_string.cpp +++ b/tests/unit/helpers/random_string.cpp @@ -41,7 +41,7 @@ random_string(std::size_t length) { thread_local static std::mt19937 rng{std::random_device{}()}; thread_local static std::uniform_int_distribution - pick(0, std::size(charset) - 1); + pick(0, std::size(charset) - 2); std::string s(length, '\0'); diff --git a/tests/unit/test_helpers.cpp b/tests/unit/test_helpers.cpp index 27d90e6b4207dd37e4da1c8f0e3ee3c6b0f7b197..c606931d05f0a532ad97ffb9e8ad82b085a56473 100644 --- a/tests/unit/test_helpers.cpp +++ b/tests/unit/test_helpers.cpp @@ -45,10 +45,11 @@ SCENARIO("random strings can be generated", "[test_helpers][random_string]") { WHEN("Length is a positive integer") { - const auto s = helpers::random_string(6); + const std::size_t n = GENERATE(range(1, 5432)); + const auto s = helpers::random_string(n); THEN(" The generated string is empty ") { - REQUIRE(s.length() == 6); + REQUIRE(s.length() == n); } } }