From 3f0ac027e2d9fa315121ffcc9f79763448312c7c Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Fri, 20 Sep 2024 22:06:11 +0200 Subject: [PATCH] Add test for zero input in randNum This commit introduces a new test case in random_test.go to ensure that the randNum function returns zero when given an input of zero. This helps validate the correctness of edge case handling in the random number generation logic. --- random_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/random_test.go b/random_test.go index caa5e58..e69b4e7 100644 --- a/random_test.go +++ b/random_test.go @@ -62,3 +62,10 @@ func TestRandomNum(t *testing.T) { }) } } + +func TestRandomNumZero(t *testing.T) { + rn := randNum(0) + if rn != 0 { + t.Errorf("random number generation failed: %d is not zero", rn) + } +}